Apache Commons JXPath
From Java Example Source Code
[edit] Overview Apache Commons JXPath
The org.apache.commons.jxpath package defines a simple interpreter of an expression language called XPath. JXPath applies XPath expressions to graphs of objects of all kinds: JavaBeans, Maps, Servlet contexts, DOM etc, including mixtures thereof.
Consider this example:
Address address = (Address)JXPathContext.newContext(vendor). getValue("locations[address/zipCode='90210']/address");
This XPath expression is equivalent to the following Java code:
Address address = null; Collection locations = vendor.getLocations(); Iterator it = locations.iterator(); while (it.hasNext()){ Location location = (Location)it.next(); String zipCode = location.getAddress().getZipCode(); if (zipCode.equals("90210")){ address = location.getAddress(); break; } }
XPath was standardized by W3C and is used in both XSLT and XPointer.
[edit] Apache Commons JXPath Resources
- Web site: http://commons.apache.org/jxpath/
- Download: http://commons.apache.org/downloads/download_jxpath.cgi
- Java API: JXPath API
- Examples: Apache Commons JXPath by exampes
- Tutorial: Users guide
- News or Forums:
