JXPath

JXPath is an XPath processor for Java which has the fairly cool capability of being able to traverse object trees and collections as well as standard DOMs. For example:

public class Employee {
  public Address getHomeAddress(){
    ...
  }
}

public class Address {
  public String getStreetNumber(){
    ...
  }
}

Employee emp = new Employee();
...

JXPathContext context = JXPathContext.newContext(emp);
String sNumber = (String)context.getValue("homeAddress/streetNumber");

Permalink: http://blog.iandavis.com/2002/05/jxpath/

Other posts tagged as technology, xml

Earlier Posts