Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Recursion

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: John Cowan <cowan AT ccil.org>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Recursion
  • Date: Wed, 10 Mar 2004 05:04:22 -0500

At 10:48 PM -0500 3/9/04, John Cowan wrote:

Fair enough; Element doesn't, after all. You could use reflection to
look for the constructor with a single String argument, though, and
blow chunks if there isn't one.

Or the double string, if you need to put something in a namespace. But what if the subclass has swapped the arguments? What if it's doing something unusual and only has constructors with three arguments? Bleah.

If I become convinced this is important to fix, I think I'm going to have to add an additional protected method whose purpose is simply to build an empty element of the relevant type. In this case, perhaps copy() could be made final. The main reason copy isn't final now is precisely so subclasses can make it return an instance of the subclass rather than an instance of the superclass. However, this would be inconsistent with the definition of final in the other Node classes so I may not do this.

I don't know. I'm really tempted to wait until someone files an actual bug on this one before fixing it. Especially since I'm seeing some evidence that the non-recursive algorithms are a big performance hit. (Not everything that needs to be O(1) to make your algorithm perform is actually O(1) in XOM. :-( ) I may be able to fix that but only at the cost of setting up and using a temporary stack in every invocation to getValue(). Even if it's O(1) the fixed costs may kill me.
--

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




Archive powered by MHonArc 2.6.24.

Top of Page