I am completely new to groovy scripting and struggling lot to get my work done. Kindly help me to resolve the below scenario.
I have soap request as below.
I need to traverse through this soap request and extract elements which will be assigned some values. (I am sorry, I am not well known of xml namings for its nodes/elements.). For example, my groovy code should yieldfollowing result
I have in my soap request more than 10 iterations for File. So, I have used #number. Please do help me at the earliest so that I can be saved from ire I am facing .
Mark, I have surfed on the internet many examples (both in groovy and java) for the same but not able to reach to a conclusion owing to my less knowledge about both.
Can you please help me by providing same in both language codes (java and groovy).
Rakshit Achary wrote:I have surfed on the internet many examples (both in groovy and java) for the same but not able to reach to a conclusion owing to my less knowledge about both.
It's simple: use Groovy's XmlSlurper to read and parse XML as it's Groovy (not Java) and it's much easier to use.
Here is a tutorial on Groovy and XML by Scott Davis (a keen Groovy advocate). It's from 2009 so the latest version of the XmlSlurper may be slightly different.