[jdom-interest] A plea for the orphans
amyzing at talsever.com
Sat Sep 16 16:47:23 PDT 2000
On Sat, Sep 16, 2000 at 02:13:11PM -0700, Jason Hunter wrote:
>> I'd like to see Attribute, Comment, Processing Instruction, and
>> possible Entity contain a member, Element parent, with getParent()
>This was proposed before by Bob to support XPath. I seem to recall he
>had started to work on implementing it. I could dig the archives, but
>it's Saturday and phooey. :-)
There's a partial, in-progress XPath engine in CVS (contribs).
>A problem with this is that our String representation of text can't have
>a getParent() and that's a bit unfortunate but not (imho) unfortunate
>enough to switch to having a Text class.
True, but not relevant. Having to externally store state when dealing
with text (which is a pain to deal with anyway, due to white space
issues) is clearly going to be the problem of the implementor of any
navigational add on (I know; I'm also in process on something that
isn't quite XPath). Neither is getParent() absolutely required. It's
just that, for navigation, if the things that *are* defined within the
API have some notion of their ancestry, life is significantly simpler.
The XML tree model demands that the implementation of navigability
treat a number of things as special cases--like the fact that
attributes *have* parents, but are *not* children. I can think of
reasons not to store parentage inside each thing where we can do so
(performance reasons, primarily--it's just a lot simpler to have
one-way links; maintenance of double links is harder, which means it
requires more bullet-proofing, which costs, and it still is likely to
break more often than single linkage), and am willing to accept those
sorts of arguments (for folks that don't need that behavior, the price
may be too high), but the fact that it can't be made consistent 'cause
String is final doesn't much move me.
Less work for me (or those who need this functionality) isn't
necessarily a compelling argument, if it means on average worse results
for a majority of users. But I'd like hear that, if that's the case.
Or other reasons, perhaps?
Amelia A. Lewis alicorn at mindspring.com amyzing at talsever.com
Do you ever feel like putting your fist through a window just so you can
More information about the jdom-interest