Reputation: 3148
I'm trying to parse a SOAP object - I am looking at the XML slurper in Groovy, but it wants to read from an XML file. I would prefer to avoid the file (there are going to be millions of lines, writing to a file isn't too practical) - is there a way to pass the SOAPResponse object to XMLSluper instead of a file?
SOAPMessage soapResponse;
Upvotes: 0
Views: 555
Reputation: 927
XmlSluprer can read XML from arbitrary sources, not just a file. You can do somehting like:
InputStream in = ...// point to your data stream
def parsedData = new XmlSlurper().parse(in)
That will get you the SOAP object as a GPathResult you can manipulate.
Good luck !
Upvotes: 1
Reputation: 187379
XMLSlurper
provides a series of overloaded parse
methods and a parseText
method that can read XML input in the following formats
You didn't mention the type of your SOAPResponse
object, but it's highly likely it's one of the above (or can easily be converted to one of these).
Upvotes: 2