That does not bring up anything. The tag is inside dataDescription. The funny thing is that both
//.[@name='dataDescription'] and //dataDescription bring up the same results - a list of dataDescription nodes. So I was just hoping that it would just work from there on by adding the [tag='10'] criteria to pick the correct one. While the first one does do that the second one does not. -----Original Message----- From: Matt Benson [mailto:[email protected]] Sent: Friday, February 15, 2013 2:06 PM To: Commons Users List Subject: Re: [jxpath] Syntax with @name Have you tried [@name='dataDescription' and @tag='10'] or something along these lines? HTH, Matt On Fri, Feb 15, 2013 at 11:51 AM, Singh, Rupinder < [email protected]> wrote: > I have a jxpath expression question. > > > > Map m = new HashMap(); > > Map[] dd = new HashMap[2]; > > dd[0] = new HashMap(); > > dd[0].put("tag", "10"); > > dd[0].put("score", "100"); > > dd[1] = new HashMap(); > > dd[1].put("tag", "11"); > > dd[1].put("score", "90"); > > Map ddk = new HashMap(); > > ddk.put("dataDescription", dd); > > m.put("Values", ddk); > > > > JXPathContext xpathContext = IDataJXPathContext.newContext(m); > > Object works = > xpathContext.getValue("//dataDescription[tag='10']"); //This returns > the correct data as expected > > Object doesntWork = > xpathContext.getValue("//.[@name='dataDescription'][tag='10']"); // > This does not bring up anything > > > > > > I have to use @name as the actual names have special characters in them. > Can anybody help with what the correct syntax for this should be ? > > > > Thanks > > > > Rupinder > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
