[XOM-interest] "Additional namespace" Exception using XMLReader
Edwin Dankert
edankert at gmail.com
Wed Aug 22 06:03:10 EDT 2007
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.
So the following simple fix worked:
<code>
StringReader reader = new StringReader(
"<test xmlns:test=\"http://www.edankert.com/test\"
test:attribute=\"whatever\"/>");
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
Builder builder = new Builder(factory.newSAXParser().getXMLReader());
builder.build(reader);
</code>
> Off the top of my head and without time to actually test, I suspect
> you're getting bitten by known design flaws in the SAXParser class.
>
> NEVER, NEVER, NEVER use that class for anything.
>
> If you can reproduce this problem without involving JAXP, I'll take
> another look at it.
Could you elaborate on this?
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?
Kind regards,
Edwin
--
http://www.edankert.com/
More information about the XOM-interest
mailing list