xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- To: jcowan AT reutershealth.com
- Cc: xom-interest AT lists.ibiblio.org
- Subject: [XOM-interest] Recursion
- Date: Mon, 8 Mar 2004 15:16:37 -0500
At 2:15 PM -0500 2/11/04, jcowan AT reutershealth.com wrote:
I note that Serializer is recursive,
and should be fixed on the same grounds: see
https://lists.ibiblio.org/sympa/arc/xom-interest/2002-September/000082.html
for the non-recursive tree-walking algorithm I used in DOMParser.
That algorithm was:
Implementation note: When I wrote DOMParser, I was careful *not* to
use recursion, because there would be no guarantee that the Java stack
wouldn't blow up. Instead I used the incremental version of walking
the whole tree:
1) firstChild, unless null, in which case
2) nextSibling, unless null, in which case
3) parent() and try again, unless root, in which case
4) stop.
I don't think I'm going to fix this in Serializer because the API change would be too limiting, but I could fix it in toXML and copy if I could figure out how to do that. However, short of setting up my own non-fixed size stack to replace the Java stack, I don't see any way to write this non-recursively. In particular, the "try again" in step 3 seems to be recursion in sheep's clothing. :-) I'm not sure what I'm not seeing here. Is there a simple way to implement this algorithm non-recursively? Or do I just need to store a stack of parent nodes that can grow larger than the Java stack?
--
Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
-
[XOM-interest] Recursion,
Elliotte Rusty Harold, 03/08/2004
-
Re: [XOM-interest] Recursion,
jcowan, 03/08/2004
- Re: [XOM-interest] Recursion, Elliotte Rusty Harold, 03/08/2004
-
Re: [XOM-interest] Recursion,
Elliotte Rusty Harold, 03/09/2004
-
Re: [XOM-interest] Recursion,
Bradley S. Huffman, 03/09/2004
- Re: [XOM-interest] Recursion, jcowan, 03/09/2004
-
Re: [XOM-interest] Recursion,
Bradley S. Huffman, 03/09/2004
-
Re: [XOM-interest] Recursion,
Elliotte Rusty Harold, 03/09/2004
-
Re: [XOM-interest] Recursion,
jcowan, 03/09/2004
-
Re: [XOM-interest] Recursion,
Elliotte Rusty Harold, 03/09/2004
-
Re: [XOM-interest] Recursion,
John Cowan, 03/09/2004
- Re: [XOM-interest] Recursion, Elliotte Rusty Harold, 03/10/2004
-
Re: [XOM-interest] Recursion,
John Cowan, 03/09/2004
-
Re: [XOM-interest] Recursion,
Elliotte Rusty Harold, 03/09/2004
-
Re: [XOM-interest] Recursion,
jcowan, 03/09/2004
-
Re: [XOM-interest] Recursion,
jcowan, 03/08/2004
Archive powered by MHonArc 2.6.24.