[XOM-interest] "Additional namespace" Exception using XMLReader

Elliotte Harold elharo at metalab.unc.edu
Wed Aug 22 08:05:01 EDT 2007


Edwin Dankert wrote:
> Thanks for the quick reply, I had another good look at the code and
> realize that I did something wrong.
> 
> The other simplified XML Object Model APIs all set the namespace-
> awareness property on the supplied XMLReader by default and XOM
> doesn't.
> 

Um, no. That's not right. The issue is not XMLReader, which is a 
correctly designed API. The issue is SAXParser and SAXParserFactory, 
which isn't.  If you stuck to XMLReader and XMLReaderFactory, this would 
not have happened.

> 
> Could you elaborate on this?
> 

You just did. This class should be namespace aware by default. It was 
designed for the non-namespace-aware SAX 1 API. It simply does not fit 
well with SAX2. I've tried to get this class removed from the JDK or at 
least deprecated, so far without success.

> I intend to use the JAXP 1.3 mechanism to validate the XML input
> document, setting the Schema object on the SAXParserFactory
> which can then provide me with a correctly configured SAXParser/XMLReader.
> 
> Would you suggest I use the
> "http://java.sun.com/xml/jaxp/properties/schemaSource" property
> instead?
> 

I usually use the Xerces specific properties for that.


-- 
Elliotte Rusty Harold  elharo at metalab.unc.edu
Java I/O 2nd Edition Just Published!
http://www.cafeaulait.org/books/javaio2/
http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/cafeaulaitA/


More information about the XOM-interest mailing list