[
Lists Home |
Date Index |
Thread Index
]
- From: Lauren Wood <lauren@sqwest.bc.ca>
- To: xml-dev@xml.org
- Date: Thu, 11 May 2000 10:22:03 -0700
Matt Sergeant wrote:
>
> On Thu, 11 May 2000, Linda Grimaldi wrote:
>
> > While I'm a relatively new member of the mailing list, it strikes me that
> > this group may be dispositionally inclined to address questions such as the
> > following:
> >
> > In the XPath spec(and, I suspect, in the XML InfoSet spec, although I
> > haven't read that one yet- it is on the list), the following statement is
> > made in the Data Model (section 5.3, for example, also 5.4 re: namespace
> > nodes) "... the element is the parent of each of these attribute nodes;
> > however, an attribute node is not a child of its parent element."
> >
> > I try not to be too obsessed by symmetry, but I find this statement somewhat
> > perplexing. Any insights? And what are the implications, if any, for
> > implementation?
>
> It's simple... You have an element node, say the method to get the
> children is getChildNodes(), this shouldn't return the attributes or the
> namespace nodes.
>
> However if you've got an attribute node, calling getParent() should return
> the element node.
Note that the W3C DOM Level 1 specification also says that elements
are not parents of attributes, to get rid of these sorts of
misunderstandings. Thus using the DOM getParent method will not get
you the element which the attribute is associated with, you have to
use the Level 2 method getOwnerElement (see
http://www.w3.org/TR/DOM-Level-2/core.html#ID-637646024 for details)
Lauren
***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************
|