commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: [jxpath] Syntax with @name
Date Fri, 15 Feb 2013 19:05:57 GMT
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 <
Rupinder.Singh@softwareag.com> 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
>
>
>
>

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