Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
<racebet amount="8.89" id="6852465" bettype="K" instance="1" type="csf" />
创建包含作为键的属性和相应值的映射的最佳方法是什么?
谢谢。
鉴于:
def xml = '<racebet amount="8.89" id="6852465" bettype="K" instance="1" type="csf" />'
你可以简单地做:
def attrmap = new XmlSlurper().parseText( xml ).attributes()