What is the bes...">

Groovy - XmlSlurper - reading attributes on a map

<racebet amount="8.89" id="6852465" bettype="K" instance="1" type="csf" />

What is the best way to create a map containing attributes like keys and corresponding values?

thank.

+4
source share
1 answer

Given:

def xml = '<racebet amount="8.89" id="6852465" bettype="K" instance="1" type="csf" />'

You can simply do:

def attrmap = new XmlSlurper().parseText( xml ).attributes()
+5
source

Source: https://habr.com/ru/post/1538752/


All Articles