Forum Discussion
3 Replies
- M_McDonaldSuper ContributorIs this any help?
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder("GetUserTypes#ResponseAsXml")
def nodeCount = holder.getDomNodes("//flex.messaging.io.amf.ASObject/map").length
log.info nodeCount
for (def nodeIndex = 1; nodeIndex <= nodeCount; nodeIndex++) {
def node = holder.getDomNodes("//flex.messaging.io.amf.ASObject["+nodeIndex+"]/map/*")
node.each {
log.info "map node " + nodeIndex + " - " + it.QName.toString() + ":" + it.firstChild.nodeValue
}
} - pleuraXeraphimOccasional ContributorThat worked great
Thanks for your help M McDonald
Much appreciated. - resmis19Occasional ContributorI have a query here.
I'm trying to read from an external xml file.
-<Currencies>
<Currency1>AUD</Currency1>
<Currency2>AWG</Currency2>
</Currencies
I can read the nodes one by one and put it in the properties file.
String s1= new File("${url}").text
def holder = groovyUtils.getXmlHolder(s1);
def C1 = holder.getNodeValue("//Currency1")
propTestStep = context.testCase.getTestStepByName("Pro")
propTestStep.setPropertyValue("Currency1", C1)
def C2 = holder.getNodeValue("//Currency2")
propTestStep = context.testCase.getTestStepByName("Pro")
propTestStep.setPropertyValue("Currency2", C2)
but I instead of this,i want to find the count and then loop using for loop.
I tried like this: def nodeCount = holder.getNodeValues
But did not return anything.
any help is appreciated.