[jdom-interest] Possible bug in SAXHandler when "namespaces" feature is off

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon Jan 19 05:27:57 PST 2004

>This issue came up when I was adding support for "external namespace
>registration" to JXPath.  There was a discussion on commons-dev at apache.org
>regarding the need to register namespaces externally.

Can you provide a reference to this discussion? What is this feature 
and why is it necessary?

>True, it does not comply with XML Namespaces, because "my" is not explicitly
>mapped to a namespace URI in the same file. But I need to parse this anyway.
>So, I turn off the "namespaces" feature.  Works like a charm with DOM. Why
>should JDOM be less flexible?

Because JDOM hits a nice 80/20 point rather than the confusing mess 
of trying to do everything you find in DOM.

>Or is there a better way?

Probably, but I'd need to understand your use-case first.

>Here's another argument. JDOM has great flexibility in regards to underlying
>SAX driver: you can provide your own if you want to. Since SAXDriver is not
>supposed to have namespaces=true, JDOM should really be prepared to handle
>the situation.

What is SAXDriver? I have not heard of this class, and I don't think 
it's anything JDOM uses.

>Finally, even if JDOM is not designed to work with SAX drivers that do not
>support namespaces, why doesn't it report that explicitly by throwing a
>relevant exception? Why doesn't it check that the driver in fact supports
>the feature?  A simple call to getFeature(), checking the result and
>throwing an exception would do.

Again, JDOM doesn't (I think) use any class called "SAXDriver" so 
there's really nothing to be done here. If you mean XMLReader (I'm 
not sure you do) there is no major implementation of XMLReader that 
does not support namespaces, and any such implementation would be 
non-conformant with the SAX spec. But I'm not sure if that answers 
your question or not. The references to "SAXDriver" are throwing me.

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)

More information about the jdom-interest mailing list