commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: JXPath unexplained behaviour
Date Wed, 10 Oct 2007 15:06:29 GMT

--- "Singh, Rupinder" <Rupinder.Singh@softwareag.com>
wrote:

> 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 ?

Please do not cross-post to both the user and dev
lists.  It seems you have uncovered some buggy
behavior related to the fact that you are looking up
keys in a map which have embedded colons, which
normally indicate namespaced content in an XML
context.  I'll have to think about what the proper
behavior would be here.  I have created the following
JIRA issue to track this:

https://issues.apache.org/jira/browse/JXPATH-104

Thanks,
Matt

> 
>  
> 
>     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
> 
> 



       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/

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


Mime
View raw message