commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Singh, Rupinder" <Rupinder.Si...@softwareag.com>
Subject JXPath unexplained behaviour
Date Wed, 10 Oct 2007 02:08:36 GMT
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


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