xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
RE: [XOM-interest] Node hierarchy does not prevent cycles
- From: "Regier Avery J" <RegierAveryJ AT JohnDeere.com>
- To: xom-interest AT lists.ibiblio.org
- Subject: RE: [XOM-interest] Node hierarchy does not prevent cycles
- Date: Fri, 12 Sep 2003 16:00:38 -0500
You can first check to see if 'a' has *any* children. If it doesn't then you
don't need to climb back up to the root of 'c' to look for 'a'. In cases
where you are building from the bottom up, you won't have to climb back to
the root for any append. You'll only do the check if 'a' already has
children.
-Avery
-----Original Message-----
From: John Cowan [mailto:jcowan AT reutershealth.com]
Sent: Friday, September 12, 2003 4:43 PM
To: Elliotte Rusty Harold
Cc: xom-interest AT lists.ibiblio.org
Subject: Re: [XOM-interest] Node hierarchy does not prevent cycles
Elliotte Rusty Harold scripsit:
> Is there any way to do this without appending the node itself? Hmm,
> seems like there might be:
>
> a.appendChild(b);
> b.appendChild(c);
> c.appendChild(a);
>
> This is a problem. It seems like it could require insertChild descend
> the entire subtree to verify the insertion is OK. Ugly. Does anyone
> see a simple, fast way to fix this?
"Piffle. A trifle."
--the incredibly arrogant Eastern Empire wizard from Mercedes Lackey
books
Ascend the "this" object's parent chain for the proposed child object.
If it's there, throw. If you reach the Document object safely, all is well.
The first two calls above will be fine because b is not an ancestor of a
and c is not an ancestor of b. But since a *is* an ancestor of c,
sproinggg....
--
"But the next day there came no dawn, John Cowan
and the Grey Company passed on into the jcowan AT reutershealth.com
darkness of the Storm of Mordor and were http://www.ccil.org/~cowan
lost to mortal sight; but the Dead http://reutershealth.com
followed them. --"The Passing of the Grey Company"
_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest
-
[XOM-interest] Node hierarchy does not prevent cycles,
McEniry, Michael, 09/12/2003
-
Re: [XOM-interest] Node hierarchy does not prevent cycles,
Elliotte Rusty Harold, 09/12/2003
- Re: [XOM-interest] Node hierarchy does not prevent cycles, John Cowan, 09/12/2003
- <Possible follow-up(s)>
-
RE: [XOM-interest] Node hierarchy does not prevent cycles,
Regier Avery J, 09/12/2003
- RE: [XOM-interest] Node hierarchy does not prevent cycles, Elliotte Rusty Harold, 09/13/2003
-
Re: [XOM-interest] Node hierarchy does not prevent cycles,
Elliotte Rusty Harold, 09/12/2003
Archive powered by MHonArc 2.6.24.