XML element to Map in Groovy. Using XMLSluper
groovy, parsing, xml
Solution
Can you try (I'm not at a computer to verify):
new XmlSlurper().parseText( xml )
.configurations
.conf
.collectEntries { c->
[ c.@name, c.attributes() ]
}
Problem
I want to convert my xml element configurations in Groovy Map in which to put all conf elements in form `Map<String, Map<String,String>>` where String is name of the conf-s elements, and in the value Map there are another attributes of current conf element ex. ``` map[0] = {one,[visivility:public,description:Configuration one.] <?xml version="1.0" encoding="UTF-8"?> <bla-module version="2.0" > <configurations> <conf name="one" visibility="public" description="Configuration one."/> <conf name="two" visibility="private" description="Configuration two."/> </configurations> </bla-module> ``` What is the fastest way to do trying to use groovy syntax and XMLSluper. PS The number of the attributes in conf-s elements are unknown