今天看到了Rod Johnson在他很久以前写的书上说, JXPath不错。
于是我去它的官方网站看了一下,确实很牛!看这一段就知道了!
======================================================
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;
}
}