Re: Node.namespaceURI

Scott Nichol writes:
 > This regards Node.namespaceURI in the DOM 3 Core.  Going back to
 > DOM 2, this attribute's description has started "The namespace URI
 > of this node, or null if it is unspecified".  To me, this seems
 > quite clear, and in programming languages like Java, I expect a
 > null value in that language to be returned.

For Python, null is mapped to the None value, which is generally used
in Python to indicate "no value".  The Python XML-SIG has gone round
and round on the issue of whether to use an empty string or None for a
missing namespace URI in the DOM, and we finally settled on None since
that's really what's intended.

 > However, there are implementations that do not use what I would
 > consider to be a null.  For example, Oracle's XML parser's
 > Node.getNamespaceURI() returns an empty (zero-length) string, and
 > Microsoft's .NET framework (the NamespaceURI property of the
 > System.Xml.XmlNode class) likewise returns an empty string.

This sounds like a serious nuissance in those implementations.

But I think the spec spells out clearly that null is the right thing.
If that's normally spelled using Java's null value, there's no need to
change the specification; the implementations are clearly in violation
and bug reports should be filed.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation

Received on Friday, 25 July 2003 11:37:24 UTC