Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Mike Colbert <mbcolbert AT yahoo.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...
  • Date: Wed, 15 Mar 2006 08:31:33 -0800 (PST)

> Attribute.getParent is conceptually different from the other
> getParent methods, and arguably should have been called
> getElement or something.

But Attribute inherits getParent from Node. I suspect I'm way off-base, but
I'm
starting to question the IS-A relationship between Attribute and Node.
Liskov/LSP
comes to mind.

Mike



----- Original Message ----
From: John Cowan <cowan AT ccil.org>
To: Mike Colbert <mbcolbert AT yahoo.com>
Cc: xom-interest AT lists.ibiblio.org
Sent: Wednesday, March 15, 2006 10:47:27 AM
Subject: Re: [XOM-interest] Attributes, ParentNodes, and "child" nodes ...


Mike Colbert scripsit:

> 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)?

Because attributes are schizophrenic: they belong to an element, but they
aren't part of the ordered sequence of children of that element, as
character content, child elements, processing instructions, and comments are.
Attribute.getParent is conceptually different from the other getParent
methods, and arguably should have been called getElement or something.

--
John Cowan
cowan AT ccil.org
I am a member of a civilization. --David Brin




Archive powered by MHonArc 2.6.24.

Top of Page