Forum Discussion

Intermountain_H_3's avatar
14 years ago

export the xpath of all nodes in the request or response

Hi all
was wondering is there a way in soapui -- ( groovy script) or report or feature to export the xpath of all nodes in the request or response to a file . All at once I know I can grap each node one at a time through the ui.

But I have requests and responses with over 800 fields matching each one become's a chore at best.
the tree is at time 8 levels deep with the same node names in differnt branches..

Going to try and make my question clearer ...
I would like to turn this into
<attributions>
<action>
<value>
<code>510055894</code>
<orginalText>actionID</orginalText>
</value>
</action>
<actionMethod>
<value>
<code>138</code>
<orginalText>ActionMethods Text</orginalText>
</value>
</actionMethod>
</attributions>

into this ::
//Result[1]/attributions[1]/action[1]/value[1]/code[1]
//Result[1]/attributions[1]/action[1]/value[1]/orginalText[1]
//Result[1]/attributions[1]/actionMethod[1]/value[1]/code[1]
//Result[1]/attributions[1]/actionMethod[1]/value[1]/orginalText[1]
  • Hi,

    the com.eviware.soapui.support.xml.XmlUtils class has a static createXPath method which takes a DOM node as an argument, so if you iterate through all nodes in the document using standard DOM functionality you should be able to call this method with each node and output its contents as desired.

    Hope this helps!

    /Ole
    SmartBear Software