25 messages in org.ibiblio.lists.xom-interest[XOM-interest] Recursion
FromSent OnAttachments
Wolfgang HoschekFeb 9, 2004 6:42 pm 
Elliotte Rusty HaroldFeb 10, 2004 9:25 am 
Wolfgang HoschekFeb 10, 2004 3:23 pm 
jco...@reutershealth.comFeb 10, 2004 3:48 pm 
Elliotte Rusty HaroldFeb 11, 2004 1:21 pm 
Wolfgang HoschekFeb 11, 2004 1:24 pm 
jco...@reutershealth.comFeb 11, 2004 2:15 pm 
Elliotte Rusty HaroldFeb 11, 2004 3:18 pm 
jco...@reutershealth.comFeb 11, 2004 4:20 pm 
Francois BeausoleilFeb 11, 2004 8:08 pm 
Trimmer, ToddFeb 12, 2004 11:57 am 
Elliotte Rusty HaroldFeb 12, 2004 2:53 pm 
Trimmer, ToddFeb 13, 2004 1:26 pm 
Elliotte Rusty HaroldMar 8, 2004 3:17 pm 
jco...@reutershealth.comMar 8, 2004 4:06 pm 
Elliotte Rusty HaroldMar 8, 2004 4:34 pm 
Elliotte Rusty HaroldMar 9, 2004 11:55 am 
Bradley S. HuffmanMar 9, 2004 12:09 pm 
Elliotte Rusty HaroldMar 9, 2004 1:05 pm 
jco...@reutershealth.comMar 9, 2004 2:04 pm 
jco...@reutershealth.comMar 9, 2004 4:32 pm 
Elliotte Rusty HaroldMar 9, 2004 10:43 pm 
John CowanMar 9, 2004 10:58 pm 
Elliotte Rusty HaroldMar 10, 2004 6:12 am 
Dirk BergstromMar 10, 2004 6:25 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[XOM-interest] RecursionActions...
From:Elliotte Rusty Harold (elh@metalab.unc.edu)
Date:Mar 8, 2004 3:17:01 pm
List:org.ibiblio.lists.xom-interest

At 2:15 PM -0500 2/11/04, jco@reutershealth.com wrote:

I note that Serializer is recursive, and should be fixed on the same grounds: see http://lists.ibiblio.org/pipermail/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? --