I am trying to parse an XML using Groovy Script's XMLSlurper plugin. I need to read the value in d:editStatus element.
import groovy.xml.*;
def myxml = '<?xml version="1.0" encoding="utf-8"?>' +
'<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">' +
'<entry>' +
'<content type="application/xml">' +
'<m:properties>' +
'<d:key>JobApplication/applicationId=94319</d:key>' +
'<d:status>OK</d:status>' +
'<d:editStatus>UPDATED</d:editStatus>' +
'<d:message>Application has been updated successfully</d:message>' +
'<d:index m:type="Edm.Int32">0</d:index>' +
'<d:httpCode m:type="Edm.Int32">204</d:httpCode>' +
'<d:inlineResults m:type="Bag(SFOData.UpsertResult)"></d:inlineResults>' +
'</m:properties>' +
'</content>' +
'</entry>' +
'</feed>'
def mystatus = new XmlSlurper().parseText(myxml)
println mystatus
Here, the output should have showed the object form of the xml but it gives me the following output
JobApplication/applicationId=94319OKUPDATEDApplication has been updated successfully0204
It is very wierd as i cannot see any elements, it is concatenating all the values and showing as output. I cannot fetch a single element.