Mis3
4 years agoFrequent Contributor
How to assign attributes of a node to variables to output to a log file?
Not sure how to assign the attributes of a node to variables so I can output to a log file. Please help. The request contains 8 API and the result contains 9 responses (1 for the whole request and ...
- 4 years ago
Here you go:
If that is output you need? Then please use
//Assuming you have data array, variable i, and xmlString //Apart from that you can remove everything from the script def line = ["Seq=${i}", data[0], data[1] ] line << new XmlSlurper().parseText(xmlString).'**'.findAll {it.name() == 'sdmDataResponse' }.collectMany{ ["FlowId=${it.@flowId}", "Status=${it.children()[0].@resultCode}" ]} log.info line.flatten()
- 4 years agoI thought I saw those brackets from your response.
Just change
line.flatten()
To
line.flatten().join(',')