Namespaces (Was: Re: [Xpath-ng] Thoughts on work products)

Jeni Tennison jeni at jenitennison.com
Tue Nov 26 06:41:16 MST 2002


Hi Bryan,

>>It's in the Data Model WD, in the Namespace Nodes section at:
>>
>>  http://www.w3.org/TR/query-datamodel/#NamespaceNode
>
> Okay, so reading this I get confused because a namespaceNode does
> not have a parent, but in 4.5.3 Accessors it says that it can be
> accessed by dm:parent, which I guess means that as the NamespaceNode
> does not have a parent the use of dm:parent returns an empty
> sequence?

That's right. Any node that does not have a parent returns the empty
sequence as the result of the dm:parent() accessor.

> What does dm:children return against a namespaceNode?

An empty sequence. See the table at:

  http://www.w3.org/TR/query-datamodel/#NamespaceNodeAccessors

> Since these are virtual functions, I suppose that they resolve to
> the equivalent axes.

Yes. Think of the accessors as the interface on to the nodes in the
node tree. Axes and functions that take nodes as arguments are defined
in terms of this interface.

> It seems to me that one reason why namespaceNodes would not have
> parents in Xpath 2.0 is the need to support XSDL.

My impression is that the decision was made because of implementation
concerns. Why do you think W3C XML Schema support necessitates
namespace nodes having no parents?

> In the Xpath-NG discussion it was suggested that the absence of
> support for parentage was not a bad thing because after all, how
> many people need to get a hold of a namespace nodes parent, maybe
> not that many, I have a feeling however that folks might be more
> used to getting a hold of position() when they need or want to.

I don't understand. Whether or not namespace nodes have a parent, you
can still get hold of them by position() if you have several in a
sequence.

> If they don't have parents does this mean they don't have ancestors?
> Said with a :) cause I expect the answer is yes.

Yes, that's right. In XPath 2.0 namespace nodes don't have ancestors
which has the funny side effect that they don't "belong" to a
document...

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/




More information about the Xpath-ng mailing list