XML : How to get specific block(group) based on child node's value in XPath from the XML?

I am newbie for XPath. I have the following XML file. Here my xml file:

  <?xml version='1.0' encoding='utf-8'?>  <items>     <item>        <country>India</country>        <referenceId>IN375TP</date>        <price>400</price>     </item>     <item>        <country>Australia</country>        <referenceId>AU120ED</date>        <price>15</price>     </item>     <item>        <country>United Kingdom</country>        <referenceId>UK862RB</date>        <price>20</price>     </item>  </items>    

I want the following tag as an output:

  <item>    <country>Australia</country>    <referenceId>AU120ED</date>    <price>15</price>  </item>          

Note: Please use condition like /items/item[referenceId/text()="AU120ED"]

No comments:

Post a Comment