What is the bes...">All geek questions in one placeGroovy - 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.+4xml groovy xmlslurpersaravana_pc Apr 30 '14 at 15:10source share1 answerGiven: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() +5tim_yates Apr 30 '14 at 15:12source shareSource: https://habr.com/ru/post/1538752/More articles:Затмение с зависимостью рабочей среды maven - вложенная война содержит папку вместо jar - eclipseCakePHP Encoding Guidelines: Why are some camelCased properties instead of CamelCased? - coding-styleIs there a Python function equivalent for all functions in JavaScript or jQuery? - javascriptnull values received in servlet using request.getParameter from jsp - javaCannot get environment variables in Elixir project - elixirGplus user authentication and getting user location in the same action - javaHow to create a queue of streaming audio in real time? - node.jsHow to bind a string variable to a datepicker control instead of a date object? - angularjsErlang CYK Implementation Code Review - erlangFunction wrapper auto-generation in C - cAll Articles
<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.
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()
Source: https://habr.com/ru/post/1538752/More articles:Затмение с зависимостью рабочей среды maven - вложенная война содержит папку вместо jar - eclipseCakePHP Encoding Guidelines: Why are some camelCased properties instead of CamelCased? - coding-styleIs there a Python function equivalent for all functions in JavaScript or jQuery? - javascriptnull values received in servlet using request.getParameter from jsp - javaCannot get environment variables in Elixir project - elixirGplus user authentication and getting user location in the same action - javaHow to create a queue of streaming audio in real time? - node.jsHow to bind a string variable to a datepicker control instead of a date object? - angularjsErlang CYK Implementation Code Review - erlangFunction wrapper auto-generation in C - cAll Articles