<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=koi8-r" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi, I've encountered some problem with performance
and found that possible reason (most probably it is not important and I'm
wrong here, I'll figure it out tomorrow, but anyway, it's kind of
performance/memory leak) is managing of "availableNamespaces" in SAXHandler. For
example, if we declare some namespace in the root element and then all
nested elements have this namespace, then for every nested element new copy
of the namespace will be added to the "availableNamespaces" and will not be
removed from it until the end of the parsing process. This is because
element's namespace is added to the "availableNamespaces" every time on
"startElement", but only "additionalNamespaces" are removed on
"endElement".</FONT></DIV>
<DIV><FONT face=Arial size=2>Possible fix is to add element's namespace
conditionally, say in such a way</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> public void startElement(String namespaceURI,
String localName,<BR> String qName,
Attributes atts)<BR> throws
SAXException {<BR><FONT face=Arial>...</FONT></FONT></DIV>
<DIV><FONT face="Arial CYR" size=2> // Remove this namespace
from those in the temp declared list<BR> if
(declaredNamespaces.size() > 0)
{<BR> if(declaredNamespaces.remove(elementNamespace))
{<BR> // It's now in available
scope<BR> availableNamespaces.addFirst(elementNamespace);<BR> }<BR> }<BR><FONT
face=Arial><FONT face=Arial>...</FONT></FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Arial CYR" size=2>, but actually I did not think about it a
lot.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Arial CYR" size=2>Thanks.</FONT></DIV></BODY></HTML>