Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] [ANN] XQuery support for XOM - please give it a try

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] [ANN] XQuery support for XOM - please give it a try
  • Date: Sun, 26 Sep 2004 09:24:26 -0700

I'm working on XQuery support and integration for XOM.
Since XQuery is a superset of XPath 2.0, it can also be used with plain XPath expressions as queries.
A working open-source prototype (BSD style license) can be downloaded from

http://dsd.lbl.gov/~hoschek/xom-contrib-download

The download inludes xom-contrib.jar and source code and has been tested against various standard XQuery test suites.
Javadoc is online:

http://dsd.lbl.gov/~hoschek/xom-contrib/

The most relevant class is XQuery:

http://dsd.lbl.gov/~hoschek/xom-contrib/nu/xom/contrib/XQuery.html

This implements the XQuery W3C Working Draft 23 July 2004 and
now requires saxon-8.1 (http://saxon.sourceforge.net/)
To get started, simply add xom-contrib.jar and saxon8.jar to the classpath.

Example usage:
// find the links of all images in a XHTML-like document
XQuery xquery = new XQuery("//img/@src", null);

// find the links of all JPG images in a XHTML-like document
// XQuery xquery = new XQuery("//img/@src[fn:matches(string(.), '.jpg')]", null);

Document doc = ...
Nodes nodes = xquery.evaluate(doc);
for (int i=0; i < nodes.size(); i++) {
System.out.println("node "+i+": "+nodes.get(i).toXML());
}

Please give this a spin and give feedback/suggestions about the API.

At some point after xom-1.0 this may become part of XOM proper, in one way or another. Before that, we'd like to gain feedback and harden the implementation in response to that.

Wolfgang.




  • [XOM-interest] [ANN] XQuery support for XOM - please give it a try, Wolfgang Hoschek, 09/26/2004

Archive powered by MHonArc 2.6.24.

Top of Page