commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luis Neves <lne...@netcabo.pt>
Subject [jxpath] Java code from JXpath expression
Date Tue, 07 Mar 2006 14:59:25 GMT

Hi all,
Is there some way of extracting the java code that is equivalent to the JXpath Expression?

Let's take the example from the JXpath main page.

1)
Address address = (Address) JXPathContext.newContext(vendor).
          getValue("locations[address/zipCode='90210']/address");

2)
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;
     }
}

I want to extract 2) as String from the JXpath expression in 1).
Did I made sense? Can this be done?


Regards,
Luis Neves


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message