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 Mikko Honkala <ho...@tml.hut.fi> on 2001/03/19 14:10:18 UTC

Possible bug: Xerces-J 1.3.0 and default namespaces

Hi,

I am pretty confident that there is a bug in Xerces 1.2.3, 1.3.0 and 1.3.1)
default namespace support. The following example describes the bug: (Using
Sun JDK 1.3)

XML document
-------------------------------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<root>

<xform id="form1" xmlns="http://www.w3.org/2000/12/xforms">
  <submitInfo id="submit1" method="postxml" />
  <instance id="instance1" xmlns="">
    <purchaseOrder>
      <shipTo>
        <name>Alice Smith</name>
        <street>123 Maple Street</street>
      </shipTo>
    </purchaseOrder>
  </instance>
</xform>

</root>

-------------------------------------
First I read the above document with the JAXP interface with namespace
support turned on.
Printing the namespace values ( element.getNamespaceURI() ) from the root,
xform and instance elements, we get the following from
Xerces 1.3.0:
--------------

root: [root: null] ns: null
xform: [xform: null] ns: "http://www.w3.org/2000/12/xforms"
instance: [instance: null] ns: ""

I think that the value of the <instance> element's namespace URI should be
null [1] [2]. This prevents me from using Xalan 2.0.0 XPath on documents
parsed with Xerces.

Xerces 1.3.1 returns:
----------------------

root: [root: null] ns: ""
xform: [xform: null] ns: "http://www.w3.org/2000/12/xforms"
instance: [instance: null] ns: ""

and again, Xalan 2.0.0 XPath does not work. This is more consistant, but
wrong by [2], since it says:

"The namespace URI of this node, or null if it is unspecified."


(When I read the same document using a copying xslt stylesheet and
Xalan 2.0.0, I get:
--------------------

root: [root: null] ns: null
xform: [xform: null] ns: "http://www.w3.org/2000/12/xforms"
instance: [instance: null] ns: null

which seems to be correct (at least XPath works)
)

[1] XML Namespaces, defaulting
http://www.w3.org/TR/1999/REC-xml-names-19990114/#defaulting
[2] DOM level 2 core,
http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247

- Mikko Honkala - http://www.x-smiles.org/



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org