I have an XML as below:
String xml = """
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope>
<soapenv:Body>
<processAsyncRequest></processAsyncRequest>
</soapenv:Body>
</soapenv:Envelope>
"""
Using Groovy, i want to find the first node name inside "Body" using XPath (//:Body/[1]/name())
Output Should be : processAsyncRequest
I am parsing the xml using XmlSlurper. But couldnt figure out the next steps to get node name using XPath
def rootNode = new XmlSlurper().parseText(xml)
Is there any simple way to achieve this? Note : the structure of my xml changes every time. So i want to use Relative Path.