Let's say I have the following XML at hand
<Envelope>
<Body>
<analyzeEffectOfReplaceOfferResponse>
<productOfferings>
<productOffering>
<id>some value</id>
</productOffering>
</productOfferings>
</analyzeEffectOfReplaceOfferResponse>
</Body>
</Envelope>
I also have the input XML in form of GPathResult after retrieving the file and parsing it:
inputXML = new XmlSlurper().parse(inputFile)
when I try to find the node like this:
inputXML."Body"."analyzeEffectOfReplaceOfferResponse"."productOfferings"."productOffering".depthFirst().findAll {it.value}
I get the required child "id"
however if I use a string that holds this text:
"Body"."analyzeEffectOfReplaceOfferResponse"."productOfferings"."productOffering"
and use it like so:
inputXML."${xPath}".depthFirst().findAll {it.value}
It doesn't work... what am I doing wrong?