[XOM-interest] FIXED Unexpected NamespaceConflictException when adding xsi:schemaLocation attribute
lenards at email.arizona.edu
lenards at email.arizona.edu
Tue Jul 29 20:49:08 EDT 2008
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
More information about the XOM-interest
mailing list