[jdom-interest] Trusting parsers with namespaces

Bradley S. Huffman hip at a.cs.okstate.edu
Sun Apr 6 11:11:36 PDT 2003


Elliotte Rusty Harold writes:

> At 1:40 PM -0700 4/2/03, nobody wrote:
> >CVS Breaks out the JAXP work into a package protected JAXPParserFactory clas
> s.
> >CVS Simplifies the SAXBuilder by removing the element Stack.
> >CVS Trusts the SAX parser to correctly report namespaces (can we trust that?
> )
> 
> Yes, you can trust that provided that you set the necessary namespace 
> features on the parser. (They are generally not set correctly by 
> default.) YOu also need to put code in setFeature() to make sure that 
> programmers don't accidentally or intentionally change the namespace 
> features to other than what we want them to be.

Right now SAXBuilder's default is to always set SAX "namespaces" to
true and "namespace-prefix" to false, and you cannot change that.

My question is why cann't they be changed?

If a developer wants to use a SAX Parser with "namespaces" set to false,
or "namespace-prefix" to true, why not?.  Shouldn't SAXHandler be
smart enough to handle namespace mappings reported though either from
startPrefixMapping or the attribute list from startElement, or both
(right now they must be reported through startPrefixMapping)?
Or if a developer doesn't care about namespaces, for whatever reason, why
shouldn't they be allowed to set "namespaces" to false.

Brad



More information about the jdom-interest mailing list