commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pantvaidya, Vishwajit" <vpant...@selectica.com>
Subject [JXPath] Performance optimization questions related to getValue(xpath) call
Date Fri, 24 Apr 2009 01:11:45 GMT
I am using JXPath 1.2 to traverse map based java object hierarchy like shown below:


public class Root {

    public Map objects;

}



The objects map has the key as a string object type and the value is a map of different object
instances of that type (keyed under individual object id's).

I am using the following code to find specific objects of a specific type (say "CustObj1"):



Root root = new Root();

...

JXPathContext context = JXPathContext.newContext(root);

String myStr=(String)context.getValue("/objects/CustObj1/*[name='Cust1']/CustInfo/InfoField1");


I have following questions:
1. Does the above xpath search restrict itself to the element in the objects map with key=CustObj1
or does it search entire map. From our performance figures, we feel as if it is going the
entire map - though we would expect it to restrict the search to objects of type=CustObj1
(as specified in the xpath expression).
2. What can I do to have jxpath search only the submap for CustObj1 - I tried creating a new
context with that submap as root - but that did not work.


Thanks.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message