[jdom-interest] JDOM support for XPath

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon Aug 28 02:54:48 PDT 2000


At 4:18 AM -0400 8/28/00, bob wrote:
>Okay,
>
>I've been outside of the CVS repository, attempting to get
>XPath stuff working for JDOM.  I'd say I've got about 75%
>of the engine implemented, and about 40% of the spec done
>(still need to implement lots of functions, and a few axis,
>but location paths, and predicates are parsing/evaluating
>smoothly).
>
>Anyhow, the only stopping point I see currently, is
>devining the 'parent' of several objects in the JDOM tree.
>
>I need to be able to backtrack from an Attribute, Comment,
>ProcessingInstruction, and the String that's used as Text
>nodes, to find the parent Element.
>
>May I request some flavor of getParent() on all of those
>classes?
>

You can request it, but you aren't going to get it. java.lang.String 
is a final class, and there's just no way we can make it support 
getParent(). :-( Paul Prescod noticed and pointed out this very 
problem (no way to get the parent) to me at Extreme two weeks ago.

We could do it by replacing String with our own Text node class as 
DOM does. This would be a major API and design change though.

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list