Forum Discussion

Ram_N's avatar
Ram_N
Contributor
17 years ago

Creating Data Soruce - from Resonse File - which has list of codes

Hi

I am trying to create Data source from list of values from Response.


For example Air port codes for letter  'B', below is the response.... when i tried to create Data source from response I am getting only first airport code in the result, but not all the codes..

Please help in 'Row Xpath' and Column XPath'

Here is the response.



 
     
       
     

     
       
       
       
       
       
       
       
       
       
       
       
       
       
       
     

     
        Baku
        BINA
        GYD
        AZE
     

     
        Bangkok
        Bangkok
        BKK
        THA
     

     
        Barcelona
        Barcelona
        BCN
        SPA
     

     
        Barnaul
        Barnaul
        BAX
        RUS
     

     
        Beijing
        Capital
        PEK
        CHN
     

     
        Beirut
        Beirut
        BEY
        LEB
     

     
        Belgrade
        Belgrade
        BEG
        YUG
     

     
        Berlin
        Schonefeld
        SXF
        GER
     

     
        Berlin
        Tegel
        TXL
        GER
     

     
        Bishkek
        Manas
        FRU
        KYR
     

     
        Bratislava
        Ivanka
        BTS
        SLK
     

     
        Brussels
        Brussels
        BRU
        BEL
     

     
        Bucharest
        Otopeni
        OTP
        RUM
     

     
        Budapest
        Budapest
        BUD
        HUN
     

 

3 Replies

  • Hello

    Ole has posted a reply for this in the SoapUI Pro forum under my question "Transfer all elements of an XML array response into a list array for later use"

    Hope this helps. If you are unable to access the forum, I can copy the relevant section to this thread

    Regards Kevin
  • Keven

    I could not locate, please help me

    thank you
    - Ramesh
  • here is Ole's response

    Hi!

    ok.. hmm.. the following script will store the xml-string for each item:

    Code:

    // get holder for response
    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def holder = groovyUtils.getXmlHolder( "Test Request#Response" )

    // select nodes
    holder.namespaces["ns"] = "http://EB.telecom.co.nz/"
    def nodes = holder.getDomNodes( "//ns:ProductOfferingSummary" )

    // create list of XML strings
    def list = []

    for( node in nodes )
    {
      java.io.StringWriter writer = new java.io.StringWriter()
      com.eviware.soapui.support.xml.XmlUtils.serialize( node, writer )
      list.add( writer.toString() )
    }

    // some debug info..
    log.info( list )
    log.info( list.size() )

    // store in context for later access
    context.nodeList = list