I'm pleased to announce the first alpha release of XOM 1.1, my free-as-in-speech (LGPL) dual streaming/tree-based API for processing XML with Java. Version 1.1 maintains backwards compatibility with XOM 1.0 while adding a number of important new features including:
setInternalDTDSubset
method in DocType
xml:id
support
The XPath support is especially useful.
You can now write declarative queries like these
that find all the person
elements instead of writing
of complicated, fragile, explicit navigation instructions:
Nodes people = doc.query("//person");
XPathContext = new XPathContext("html", "http://www.w3.org/1999/xhtml");
Nodes toc = doc.query("//html:div[@id='toc']/child::node()", context)
The XPath support is based on the latest Jaxen source code.
This is the same engine used in JDOM and dom4j. However, before bundling this
with XOM I fixed a lot of bugs in Jaxen, and worked around several others.
XOM is much more conformant to the XPath specification than either JDOM or dom4j. There's still at least one nasty bug in XPath evaluation I haven't been able to fix yet, but so far I've only seen it with an unusual, redundant union expression that's unlikely to arise in practice (//. | /
). More importantly, there are probably other undiscovered bugs waiting to bite. If you spot any of the critters, holler and I'll try to stomp them.