Can somebody explain the unusual behaviour in the following code. The
selectNodes method does not match anything but selectSingleNode does
return the correct node for the same jxpath query. Are these two method
supposed to behave differently ?

 

    Map child = new HashMap();

    child.put("fname", "testfname");

    child.put("id", "1");

    child.put("lname", "testlname");

    Map name = new HashMap();

    name.put("tns:name", child);

    Map data = new HashMap();

    data.put("person", name);

    JXPathContext context = JXPathContext.newContext(data);

    List l = context.selectNodes("person/tns:name/id");  //This returns
nothing

    context.selectSingleNode("person/tns:name/id"));     //This returns
the value 1

 

Thanks

 

Rupinder

Reply via email to