[jdom-interest] XPath implementation started
hincheymg at yahoo.com
Sun Jul 30 11:28:13 PDT 2000
I checked in some classes to jdom-contrib for XPath.
The backing implementation is likely to change soon
(Bob and I are still working on an antlr version) but
this will let the curious try it out, start the
discussion on the API, and give Jason and Brett
something to point to for all the questions.
For now, org.jdom.contrib.xpath.XPathElement is the
entry-point API to the functionality. Example usage:
XPathElement xpath = new XPathElement(myElement);
List grandchildren =
String grandchildValue =
Package org.jdom.contrib.xpath.a is somewhat
temporary, but you don't need to call it directly. It
will be replaced by Bob's antlr parser, and a new
JDOMLocator based on that. This was my original
parser and locator not based on antlr. Most of the
xpath axes are supported except for "following" and
"preceding". And root (such as "/a/b") has a known
bug. The only support for predicates is the index
value as in the examples above. (Keep in mind,
indexes are one-based, not zero.)
The test suite is in jdom-test,
org.jdom.contrib.xpath.test package. You can look
here for numerous examples of xpaths that currently
P.S. No problems with Jason's updates today.
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
More information about the jdom-interest