Skip to Content.
Sympa Menu

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

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Edwin Dankert" <edankert AT gmail.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] "Additional namespace" Exception using XMLReader
  • Date: Tue, 21 Aug 2007 15:17:02 +0100

I noticed the following strange behavior.

The following exception occurs:

"Additional namespace http://www.edankert.com/test for the prefix test
conflicts
with existing namespace binding"

This happens when constructing the Builder with a XMLReader (constructed
using JAXP) and then providing the builder with the following XML to build:

<test xmlns:test="http://www.edankert.com/test"; test:attribute="whatever"/>

This is where it all goes wrong:

<code>
StringReader reader = new StringReader(
"<test xmlns:test=\"http://www.edankert.com/test\";
test:attribute=\"whatever\"/>");

Builder builder = new Builder(
SAXParserFactory.newInstance().newSAXParser().getXMLReader());
builder.build(reader);
</code>

The following cases however do not give any problems:

<code>
StringReader reader = new StringReader(
"<test xmlns:test=\"http://www.edankert.com/test\";>"+
"<child test:attribute=\"whatever\"/>"+
"</test>");

Builder builder = new Builder(
SAXParserFactory.newInstance().newSAXParser().getXMLReader());
builder.build(reader);
</code>

<code>
StringReader reader = new StringReader(
"<test xmlns:test=\"http://www.edankert.com/test\";
test:attribute=\"whatever\"/>");

Builder builder = new Builder();
builder.build(reader);
</code>

Kind regards,
Edwin
--
http://www.edankert.com/




Archive powered by MHonArc 2.6.24.

Top of Page