Forum Discussion

Dwango's avatar
Dwango
New Contributor
16 years ago

Conditional Goto on value existance?

I've got a return value from with multiple returns of the same type as follows:


 
     
        xmlns:ns2="urn:mask:v2" xmlns:ns3="http://www.opengis.net/gml"
        xmlns:ns4="http://metadata.mask.mask/mdr/ns/MASK/1.4/">
       
            PAC00
            PAB00
            PAA00
            PA100
            P4500
            P0Y00
       

     

 


I need to verify if a string such as PAA00 exists.  Can I do it with an XPath expression in a Conditional Goto or do I need to use a Groovy script to evaluate the values and run the step I need?  I don't really don't know if xpath can check for a value if there are multiple children of the same node.

Thanks in advance for help on this.  If I missed a post, please let me know.
  • Dwango's avatar
    Dwango
    New Contributor
    Well, I used a Groovy script step to do this.  I did as follows:


    def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
    def holder = groovyUtils.getXmlHolder( "GetIds#Response" )
    def holder_text = holder.xml
    if (holder_text =~ 'RDV00'){
    log.info( 'true' )
    testRunner.gotoStepByName("CreateValue")
    }
    else
    log.info( 'false' )


    So, I gave up parsing with XPath and used the getXmlHolder().xml property as a string and searched it, since I know the value will only occur once if it exists.