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

Re: Resolution of XPath DOM LC issue B5

From: Ray Whitmer <rayw@netscape.com>
Date: Thu, 05 Sep 2002 12:45:47 -0700
Message-ID: <3D77B46B.8070709@netscape.com>
To: Joseph Kesselman <keshlam@us.ibm.com>
CC: www-dom@w3.org

Joseph Kesselman wrote:

>Alternative suggestion:
>
>There had been discussion of moving the ownerElement attribute back into 
>Node, to make it a general equivalent of XPath's concept of parent, saving 
>them the coding hassle of 
>        (node.getType()==Node.ATTR_NODE) ? node.getOwnerElement() : 
>node.getParent()
>and making the relationship between the DOM and XPath views somewhat more 
>straightforward. This would also have to skip past EntityReference nodes, 
>since those don't exist in the XPath model; I don't remember any other 
>complications but it's been a while since I've looked at it.
>  
>
I do not recall such a discussion.  This would be a core issue.  

In practice, it doesn't seem to me to be a big hassle anyway, since most 
normal applications know if they have an attribute node to start with 
before asking for the parent or owner element, and it is no problem for 
the XPath implementation to do the above a few times and heavy XPath 
users can just use expressions to get the behavior.

In DOM, there are additional cases, such as attributes which have text 
nodes underneath them.  The parent of the text node is clearly the 
attribute so the model breaks down even though an XPath user would 
probably never get to that particular text node.

>Relatively simple architectural change, non-breaking, should be low impact 
>on implementers and it'd close this issue in a manner which (I think) the 
>XPath folks would actually be happy with rather than tolerant of.
>
>Has this been considered and voted down, or did it simply fall through the 
>cracks?
>  
>
As this was not the only comment we got suggesting that Node attributes 
should match XPath instead of the established DOM->infoset mapping (for 
example prefix, namespaceURI, etc.), the impression I get from this sort 
of thing is that they think that the parent attribute of an attribute 
should be the element, even though it is not a child of element and they 
consider it a matter of using the "right" names to avoid confusion for 
XPath users.  It will obviously not solve the fact that we do not 
consider the element the parent of it's attributes or call it that, 
which was established in DOM Level 1 long before XPath.

Can you perhaps make a stronger argument?  I am not well-enough 
convinced that this proposal significantly helps anyone.

Perhaps if it solved more problems...  entity reference skipping seems 
like another side benefit.  The root node would have to have no owner 
element, etc. as this would be the closest ancestor that was an element...

Ray Whitmer
rayw@netscape.com
Received on Thursday, 5 September 2002 15:46:20 GMT

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