Transform XML into a Map using groovy
问题 I have some XML that I want to transform into a Map. I used the middle way of transforming XML to JSON and then greating a map of the json: import org.json.XML import groovy.json.JsonSlurper Map parseXml(String input) { String json = XML.toJSONObject(input).toString() new JsonSlurper().parseText(json) } But when you have name spacing, it does not get removed. eg. <ns2:someObject xmlns:ns2="http://someLink"> <someOtherObject> <something>SOME_THING</something> </someOtherObject>