[jdom-interest] Namespace declaration "gets lost"

Laurent Bihanic laurent.bihanic at atosorigin.com
Thu Oct 17 09:11:10 PDT 2002

Bradley S. Huffman wrote:

> Looks like it been in since b6 or so. Looking deeper, why do we even worry
> about keeping track of in-scope namespaces? Looks like the only time
> SAXHandler's getNamescape is called is when a attribute has a prefix. Why
> not just use element.getNamespace(String) to get the namespace and handle
> the housekeeping? For most cases it should match the elements namespace.
> Tried this last night and it seemed to shave off a few cycles for test cases
> with a high number of attributes (probably from getting rid of the iterator
> creation).

Why not just using Attributes.getURI(int), assuming the parser does its job 

> Also looking at Element.getNamespace(String) shouldn't it also return
> Namespace.XML_NAMESPACE for the prefix 'xml'?

It does as the SAXHandler(JDOMFactory) constructor adds the XML_NAMESPACE to 
the list of available namespaces.


More information about the jdom-interest mailing list