<racebet amount="8.89" id="6852465" bettype="K" instance="1" type="csf" />
What is the best way to create a map containing the attributes as keys and the corresponding values?
thanks.
<racebet amount="8.89" id="6852465" bettype="K" instance="1" type="csf" />
What is the best way to create a map containing the attributes as keys and the corresponding values?
thanks.
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()
XmlParser
is used. –
Farrel assert new XmlSlurper().parseText( xml ).getClass().name == 'groovy.util.slurpersupport.NodeChild'
–
Stop © 2022 - 2024 — McMap. All rights reserved.