We are consuming a web service response xml and I am able to retrieve data for s

We are consuming a web service response xml and I am able to retrieve data for specific tags using this syntax:

if( (xpathsnippet(pv!customersOnAccountResponseBody_Txt, "//*[local-name(.)='ReturnCode']/text()")) = "", "", xpathsnippet(pv!customersOnAccountResponseBody_Txt, "//*[local-name(.)='ReturnCode']/text()") )

The problem with the above results is that I get all instances of the tag "ReturnCode". I only want the data from this tag when its in a particular child tag. How would the syntax change above then?

I have tried absolute and realize path's and neither work....

OriginalPostID-60116

OriginalPostID-60116

  Discussion posts and replies are publicly visible

Parents
  • In XPath, using "//" says, "Get this node everywhere in the XML no matter where it is." In order to specify only some paths to the node, you will need to give the full path instead. I _think_ something like this should work, /root-element/parent/*[local-name(.)='ReturnCode']/text()")) = ""

    "root-element" and "parent" should be replaced as appropriate based on your specific XML structure.

    I've always relied on the W3Schools XPath tutorial as a reference. www.w3schools.com/.../
Reply
  • In XPath, using "//" says, "Get this node everywhere in the XML no matter where it is." In order to specify only some paths to the node, you will need to give the full path instead. I _think_ something like this should work, /root-element/parent/*[local-name(.)='ReturnCode']/text()")) = ""

    "root-element" and "parent" should be replaced as appropriate based on your specific XML structure.

    I've always relied on the W3Schools XPath tutorial as a reference. www.w3schools.com/.../
Children
No Data