RE: data model: parent of namespace nodes

> Kay, Michael wrote:
> 
> > The intention is that the model is the same as the XPath 1.0 model, 
> > i.e. there is a one-to-many relationship between element nodes and 
> > namespace nodes, this relationship is called "dm:namespaces" in one 
> > direction and "dm:parent" in the other.
> 
> The XPath 1.1 specification (section 5.4) says:  "Elements 
> never share namespace nodes: if one element node is not the 
> same node as another element node, then none of the namespace 
> nodes of the one element node will be the same node as the 
> namespace nodes of another element node."

[I assume by 1.1 you mean 1.0?]
> 
> (This seems awfully wasteful, though I guess implementors can 
> create the namespace nodes on-demand.)

A naïve implementation certainly is very wasteful. Even implementations that
create the nodes on demand (as I suspect most XPath 1.0 implementations do)
can incur considerable costs. This is why we have deprecated the namespace
axis: this means that an XPath 2.0 implementation never needs to expose
namespace nodes to the application, which in turn means that questions about
their identity and parentage are somewhat academic. Having deprecated the
namespace axis, it made sense to decide that where it is supported, it
should be supported with exactly the XPath 1.0 semantics. 
> 
> The quoted section expressly contradicts the Example in 
> appendix D of the Data Model document, where all the elements 
> have the same set of namespace nodes:
> dm:namespaces(E2)  =  ([N1], [N2], [N3], [N4], [N5])

It looks as if the appendix needs to be fixed.

Michael Kay

Received on Monday, 12 May 2003 22:36:56 UTC