xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...
- From: Gregory Garretson <gregory AT garretson.info>
- To: Michael Kay <mike AT saxonica.com>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...
- Date: Wed, 15 Mar 2006 11:57:10 -0500
Michael Kay wrote:
Actually, I think you're confusing two problems that come from different sources. The expectation that things will have two parents is a problem that comes with the use of the "parent-child" analogy to describe trees. However, since it is very well established in computer science (and graph theory) to speak of a tree in terms of parent and child nodes, it isn't a bigger problem here than it is anywhere else, which, I would argue, is still not much.Why is an Attribute a Node that has a ParentNode as a parent, as returned by attribute.getParent(), but at the same time it's not a child of a ParentNode, as returned by parent.getChild(n)?
When people ask that question of the XPath model, my usual response is: it
was a mistake to use the word "parent" for the relationship between a node
and its owner, given that (a) we expect parent to be the inverse
relationship of child, and (b) we expect things to have two parents, not
one.
On the other hand, I think that your point (a) is very good; even in comp sci, we typically expect the parent-child relationship to be a reciprocal one, so if c.getParent() returns p, then we should expect p.getChild(n) to return c for some n. Perhaps there should be a different name for getParent(), as John suggests. But then there's the inheritance problem that Mike C. brings up. Sorry I don't have any good suggestions...
Gregory
-
Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...
, (continued)
-
Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...,
Tatu Saloranta, 03/15/2006
-
Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...,
Mike Colbert, 03/15/2006
- Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ..., Wolfgang Hoschek, 03/15/2006
- Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ..., John Cowan, 03/16/2006
- Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ..., Mike Colbert, 03/16/2006
- Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ..., John Cowan, 03/16/2006
- Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ..., Mike Colbert, 03/16/2006
- Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ..., Michael Kay, 03/16/2006
- Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ..., Tatu Saloranta, 03/16/2006
-
Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...,
Mike Colbert, 03/15/2006
-
Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...,
Tatu Saloranta, 03/15/2006
-
Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...,
Gregory Garretson, 03/15/2006
- Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ..., Michael Kay, 03/15/2006
Archive powered by MHonArc 2.6.24.