[xquery-talk] [ANN] Nux-1.0a2 - XQuery support for XOM

Wolfgang Hoschek whoschek at lbl.gov
Tue Oct 12 12:50:37 PDT 2004


Nux has matured, and this is to announce the availability of the 
nux-1.0a2 release.

Nux (http://dsd.lbl.gov/nux) is a small, straightforward, and 
surprisingly effective open-source extension of the Java XOM XML 
library. Nux provides seamless W3C XQuery support for XOM (through 
Saxon). Since XQuery is a superset of XPath 2.0 it  can also be used 
with plain XPath expressions as queries. Nux also offers efficient and 
flexible pools and factories for XQueries, XSL Transforms, as well as 
Builders that validate against W3C XML Schemas (through Xerces).

Usage can be as simple as that:

       // 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 via 
regular expression
       // XQuery xquery = new XQuery("//*:img/@src[matches(., '.jpg')]", 
null);

       Document doc = 
BuilderPool.GLOBAL_POOL.getBuilder(false).build(new 
File("/tmp/test.xml"));
       Nodes results = xquery.evaluate(doc).toNodes();
       for (int i=0; i < results.size(); i++) {
           System.out.println("node "+i+": " + results.get(i).toXML());
           //System.out.println("node "+i+": " + 
XOMUtil.toPrettyXML(results.get(i)));
       }

If you'd like to query non-XML documents such as the typical HTML that 
lives out there, you can combine Nux with TagSoup, as described in the 
documentation.

The API is considered stable by now, but there may still be small 
changes in response to community feedback.
So let us know of any issues.

Wolfgang.

-----------------------------------------------------------------------
Wolfgang Hoschek                  |   email: whoschek at lbl.gov
Distributed Systems Department    |
Berkeley Laboratory               |   http://dsd.lbl.gov/~hoschek/
-----------------------------------------------------------------------



More information about the talk mailing list