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: Re: [XOM-interest] Recursion
- Date: Tue, 9 Mar 2004 22:40:08 -0500
At 4:32 PM -0500 3/9/04, jcowan AT reutershealth.com wrote:
Unfortunately, I think this is the important one, because it's not
replaceable. If you foresee a problem with serializing, you can use a
different serializer, but Element.copy and Element(anElement) are critical
parts of the API. And if you are running a server that is meant to handle
arbitrary incoming documents (and assuming you have some check for gross
size), then blowing up on nesting depth is really not acceptable.
How much nesting would typically be required to expose this? Personally, I've never noticed this problem when recursively processing a document with XOM or other APIs. How far can Java programs recurse before the stack blow up? Hundreds? Thousands? Millions? I have noticed when I accidentally write an infinite recursion it takes on the order of a minute before the program comes crashing down around me. That suggests it can go pretty deep.
A way to avoid the API wart would be to check if the element to be copied
is an actual Element or a subclass, and in the latter case, using
sourceElement.getClass().newInstance() to call the argless constructor.
But the subclass may not have a no-args constructor.
--
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, Dirk Bergstrom, 03/10/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.