W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2002

DOM 3 XPath: default namespace nodes?

From: Perry A. Caro <caro@adobe.com>
Date: Fri, 13 Sep 2002 16:05:57 -0700
Message-ID: <3D826F55.D62A80AE@adobe.com>
To: www-dom@w3.org
CC: caro@adobe.com

This is an implementation question regarding both the default namespace as
defined by "xmlns=", and special-case namespaces/prefixes, such as for xml:
and xmlns:.

If the XML parsed into the DOM was the following:

	<doc xmlns="default/" />

and the context for XPath evaluation is the node "doc", what should the
following XPath return as the result set, assuming I asked for
ORDERED_NODE_SNAPSHOT_TYPE?

	namespace::*

If the above syntax is not exactly right, please correct me, but the general
idea is that I'm trying to get all of the namespace nodes in scope for the
"doc" element.

In particular, what should all of the Node attributes be for the
XPathNamespace node that represents xmlns="default"?

Here's what I believe the answers should be:

An ordered snapshot of length 3:

Result[0] = XPathNamespace { // Note: omitted attributes are null or false
	nodeName:	"xml"
	nodeType:	13
	ownerDocument:	(Document node)
	namespaceURI:	"http://www.w3.org/XML/1998/namespace"
	prefix:		"xml"
}

Result[1] = XPathNamespace { // Note: omitted attributes are null or false
	nodeName:	"xmlns"
	nodeType:	13
	ownerDocument:	(Document node)
	namespaceURI:	"http://www.w3.org/2000/xmlns/"
	prefix:		"xmlns"
}

Result[2] = XPathNamespace { // Note: omitted attributes are null or false
	nodeName:	"" // i.e., empty string, NOT null
	nodeType:	13
	ownerDocument:	(Document node)
	namespaceURI:	"default/"
	prefix:		"" // i.e., empty string, NOT null
}

=========================

Things I'm not completely sure about:

* Should the special-case namespace nodes always be in scope?

* Should the "xml:" special-case be included, and if so, should
its order be before xmlns:?

* For xmlns="default/", should the nodeName and prefix be empty string, or
null?  I'm assuming empty, because I can find no reference in any DOM Core
spec that permits nodeName to be null, and I'm told that anything not
expressly permitted in the spec is forbidden.

Perry A. Caro
Adobe Systems Incorporated
Received on Friday, 13 September 2002 19:05:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:56 GMT