xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
[XOM-interest] Node hierarchy does not prevent cycles
- From: "McEniry, Michael" <mmceniry AT itsc.uah.edu>
- To: <xom-interest AT lists.ibiblio.org>
- Subject: [XOM-interest] Node hierarchy does not prevent cycles
- Date: Fri, 12 Sep 2003 13:29:51 -0500
The node hierarchy does not prevent cycles
(aka "I'm my own grandpa").
The simplest example is:
Element a = new Element("a");
a.appendChild(a);
// time passes...
a.toXML(); // causes a StackOverflowError
In my case, it was a dumb typo, but the error appears
far away from the typo, and I consumed what few sanity
points I had left tracking this down.
Should ParentNode.insertChild(Node child, int position)
climb its own parent tree looking for child?
...
for (ParentNode parent = this;
parent != null;
parent = parent.getParent()) {
if (parent == child) {
throw new SomeException("cyclic hierarchy");
}
}
...
Has this been discussed before? If so, please,
point me there. Thanks.
-
[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.