You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Tom Bradford <br...@dbxmlgroup.com> on 2000/11/17 07:06:14 UTC
Incompatibility in Xerces J DOM Parser
Hello,
I've run into a problem with the Xerces J DOM Parser. I encountered it
with 1.1.3 but I believe this is also the case with 1.2.x.
When the DOMParser calls createElementNS and createAttributeNS, it
passes the namespaces correctly, but only passes the local part of the
element/attribute names. The DOM Document interface requires a
qualified name for createElementNS and createAttributeNS.
The standard DOMParser that generates a Xerces DOM seems to work around
this problem in most cases (I'll explain the case where it might not).
In my case, I've created a subclass of DOMParser that generates a dbXML
compressed DOM instead of a Xerces DOM. The dbXML DOM implementations
for createElementNS and createAttributeNS conform to the DOM
specification, and require a qualified name for prefix resolution. As
it stands right now, prefixed namespaces always fail with the dbXML DOM
implementation using the Xerces DOMParser, and default scoped namespaces
work fine.
Here's an example of the case where this should fail even with the
Xerces DOM.
<element xmlns:a="http://www.test.org" xmlns:b="http://www.test.org">
<a:blah />
<b:blah />
</element>
Even though the namespaces are identical, the prefixes aren't,
ultimately confusing the DOM when you try to reserialize, especially if
you happen to change the value of one of the xmlns:x attributes (and
effectively the namespace for that prefix) because the DOMParser didn't
initially create the elements with a qualified name.
Thanks,
--
Tom Bradford
Chief Software Architect
The dbXML Group
http://www.dbxmlgroup.com
Re: Incompatibility in Xerces J DOM Parser
Posted by Tom Bradford <br...@dbxmlgroup.com>.
Tom Bradford wrote:
> I've run into a problem with the Xerces J DOM Parser. I encountered it
> with 1.1.3 but I believe this is also the case with 1.2.x.
>
> When the DOMParser calls createElementNS and createAttributeNS, it
> passes the namespaces correctly, but only passes the local part of the
> element/attribute names. The DOM Document interface requires a
> qualified name for createElementNS and createAttributeNS.
Hello,
Attached is my DOMParser.java fix. The change is only one line... It
now calls createElementNS with rawname instead of localpart. The file
is from xml-xerces_20001117171946.tar.gz (the most recent development
snapshot of 1.2.x).
Thanks,
Tom
--
Tom Bradford
Chief Software Architect
The dbXML Group
http://www.dbxmlgroup.com