Forum Discussion

testguru's avatar
testguru
Occasional Visitor
6 years ago

How do I access the XPath within an XML Node?

I am trying to access an attribute within an XML node. How would I do this?

 

<data:TransactionAdd AccountID="?">

 

I need to access the AccointID attribute, but when I map to TransactionAdd the XML is going after the TransactionAdd header.

 

Looks like this <data:TransactionAdd AccountID="?">XPATH LEADS HERE<Optional>

 

How do I access the variable AccountID via XPath?

1 Reply

  • avidCoder's avatar
    avidCoder
    Super Contributor

    Did you try this approach?

    def gutils = new com.eviware.soapui.support.GroovyUtils( context );
    def holder = gutils.getXmlHolder("Request_Name#Response");
    
    def accountId = holder.getNodeValue("//data:TransactionAdd/@AccountID");