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.

Reply via email to