vijaydi
13 years agoContributor
capture values under similiar XPath in an array with groovy
In soapUI, using groovy, I have the following piece of code to capture the value of a XPath. There are 23 of these values under similiar XPath in an array like structure (ns5:search-result[1], ns5:search-result[2]...and so on ns5:search-result[23])
I wanted to capture all the values in an arrray and datasink them to an excel. I tried to give ns5:search-result[all] (see below linwe of code), and defined matchindicator as an array but did not work.
Would like to get your thoughts as to how best we can capture these values in an array.
Thank you
def matchindicator = context.expand( '${IDM_Modified#Response#declare namespace ns5=\'http://vedaxml.com/vxml2/idmatrix-v2-0.xsd\'; //ns5:response[1]/ns5:search-results[1]/ns5:search-result[1]/@match-indicator}' )
def matchindicator2 = context.expand( '${IDM_Modified#Response#declare namespace ns5=\'http://vedaxml.com/vxml2/idmatrix-v2-0.xsd\'; //ns5:response[1]/ns5:search-results[1]/ns5:search-result[2]/@match-indicator}' )
I wanted to capture all the values in an arrray and datasink them to an excel. I tried to give ns5:search-result[all] (see below linwe of code), and defined matchindicator as an array but did not work.
matchindicator = context.expand( '${IDM_Modified#Response#declare namespace ns5=\'http://vedaxml.com/vxml2/idmatrix-v2-0.xsd\'; //ns5:response[1]/ns5:search-results[1]/ns5:search-result[all]/@match-indicator}' )**strong text**
Would like to get your thoughts as to how best we can capture these values in an array.
Thank you