xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] "Additional namespace" Exception using XMLReader
- From: "Edwin Dankert" <edankert AT gmail.com>
- To: "Elliotte Rusty Harold" <elharo AT metalab.unc.edu>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] "Additional namespace" Exception using XMLReader
- Date: Wed, 22 Aug 2007 11:03:10 +0100
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/
-
[XOM-interest] "Additional namespace" Exception using XMLReader,
Edwin Dankert, 08/21/2007
-
Re: [XOM-interest] "Additional namespace" Exception using XMLReader,
Elliotte Rusty Harold, 08/21/2007
-
Re: [XOM-interest] "Additional namespace" Exception using XMLReader,
Edwin Dankert, 08/22/2007
- Re: [XOM-interest] "Additional namespace" Exception using XMLReader, Elliotte Harold, 08/22/2007
-
Re: [XOM-interest] "Additional namespace" Exception using XMLReader,
Edwin Dankert, 08/22/2007
-
Re: [XOM-interest] "Additional namespace" Exception using XMLReader,
Elliotte Rusty Harold, 08/21/2007
Archive powered by MHonArc 2.6.24.