Re: XPath namespace nodes

On Friday, 09/13/2002 at 10:25 MST, (Ray Whitmer) wrote:
> DOM Namespace nodes are clearly NOT created when the DOM element is
> created.

They're created when the XPath runs, which I think is fine; anything 
before that is "parse time" for XPath's purposes.

The only thing which might make this distinction visible would be that we 
may produce new objects each time. HOWEVER -- remember that object 
identity is *not* the official way to test DOM node identity; that can 
only be done portably via the DOM L3  isSameNode() method. That could be 
appropriate jiggered to return true for namespace node objects created via 
two separate queries, if they declare the same prefix and namespace and if 
the ownerElements match (also conceptually tested via isSameNode()).

Note that in XPath 2.0 current draft the question of ownership of 
namespace nodes pretty much goes away -- they allow it to be assigned 
fairly arbitrarily, so it _could_ be the ownerElement of the actual Attr 
this namespace came from.  (Xalan takes that approach and trusts XPath 2.0 
will bless it. Fact is, almost nobody uses the namespace axis and of those 
a vanishingly small number ever ask for the XPath-parent of a namespace 
node, so this deliberate divergence from XPath 1.0 makes very little 
real-world difference.)

Joe Kesselman  / IBM Research

Received on Friday, 13 September 2002 13:46:44 UTC