Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] FIXED Unexpected NamespaceConflictException when adding xsi:schemaLocation attribute

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: lenards AT email.arizona.edu
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] FIXED Unexpected NamespaceConflictException when adding xsi:schemaLocation attribute
  • Date: Tue, 29 Jul 2008 17:49:08 -0700

I knew I should have waited to send my message...

I found a snippet of XOM code with a google search so I tried it:

Element root = new Element(PageContentElements.ROOT_RESPONSE, NS);
root.addNamespaceDeclaration("xsi",
"http://www.w3.org/2001/XMLSchema-instance";);
root.addAttribute(new Attribute("xsi:schemaLocation",
"http://www.w3.org/2001/XMLSchema-instance";,
"http://www.foo.org/transfer/content/0.1
http://services.foo.org/schema/content_0_1.xsd";));

No exception and the attribute is added as expected.

I thought the code felt redundant. So I pulled out the namespace decl:

Element root = new Element(PageContentElements.ROOT_RESPONSE, NS);
root.addAttribute(new Attribute("xsi:schemaLocation",
"http://www.w3.org/2001/XMLSchema-instance";,
"http://www.foo.org/transfer/content/0.1
http://services.foo.org/schema/content_0_1.xsd";));

And that works too.

From a blackbox perspective, I'm still a little puzzled as to why the code I had
was caused an exception?

What's the idea behind that code causing an exception?

I guess I should just look at the source... but I'm curious the thoughts of
those on the list.

Andy





Archive powered by MHonArc 2.6.24.

Top of Page