我想在Groovy Map中转换我的xml元素配置,其中将所有conf元素放在Map
其中String是conf-s元素的名称的形式
中,并且在值Map中有当前conf元素ex的另一个属性.
map[0] = {one,[visivility:public,description:Configuration one.]
尝试使用groovy语法和XMLSluper的最快方法是什么.PS conf-s元素中的属性数量未知
你可以尝试(我不是在电脑上验证):
new XmlSlurper().parseText( xml ) .configurations .conf .collectEntries { c-> [ c.@name, c.attributes() ] }