[jdom-interest] XPath

Jason Hunter jhunter at collab.net
Tue Jun 20 17:18:43 PDT 2000


Michael Hinchey wrote:
> 
> I'm working on an XPath library for JDOM, which could be included for 1.1.
> It's not ready for beta yet, but I'll give a description of the design, to
> ask for evaluation, feedback and help if anyone is interested.  If there is
> interest and Brett and Jason agree to it, I'll submit the code to jdom
> contrib in a couple weeks.

Excellent!  This is my favorite aspect of Open Source -- where someone
comes out of the woodwork with an extremely useful and value adding
contribution.  I look forward to receiving the code.  It'll be easier to
debate and improve the design with code in hand.

> Example usage:
>     JDOMLocator locator = new JDOMLocator();
>     locator.setContextElement(element);
>     List matches = locator.match("child::Chapter/child::node() |

> A method such as match(String xpath):List could be added to Element for JDOM
> 1.1.  

Such a method on Element seems like the right thing to do for 1.1. 
We'll have to figure out the name.  getXPathMatch() might be more
explicit.  Plenty of time for that debate though.

Is there something done in the JDOMLocator?  Could the class be a simple
static with a JDOMLocator.match(Element, String) method, or maybe a
singleton?  That would make it easier to write the Element.match()
method without needing object creation.

> There is still quite a bit of work to do, but because of the organization,
> it would not be difficult to split it among a couple more developers.  

Once you submit the code I'm sure there'll be many interested parties
who will help out to varying extents.  Two people who I remember saying
they'd help with XPath work were philip.nelson at omniresources.com and
Richard.Taylor at bskyb.com.  There were others whose emails have fallen
through the cracks.  You'll probably hear from them as development
progresses.  :-)

Thanks in advance for your work, Michael.

-jh-



More information about the jdom-interest mailing list