I have an XML like below.
xml1 = '''
<?xml version="1.0" encoding="UTF-8"?>
<soap>
<group1>
<g1node1>g1value1</g1node1>
<g1node2>g1value2</g1node2>
<g1node3>g1value3</g1node3>
</group1>
<group2 attr="attrvalue1">
<g2node1>g2value1</g2node1>
<g2node2>g2value2</g2node2>
<g2node3>g2value3</g2node3>
</group2>
</soap>
'''
Here, i need to get all the xml node and its values as output, either as line by line result and as a list with groovy. The output should look like
g1node1 = g1value1
g1node2 = g1value2
... and so on...
or either with a groovy map like below
out = [g1node1 : "g1value1", g1node2 : "g1value2", ...and so on...]
can anyone help me how to achieve this with groovy code?