Forum Discussion

mohbubur_rahman's avatar
mohbubur_rahman
Contributor
16 years ago

Multiple Child elements

Hi,

I have a response of the followin;


           
              arce sceptra
              circum claustra fremunt
              2017-08-17T12:44:20
              P1Y4DT12H44M37S
           

           
              arce sceptra2
              circum claustra fremunt2
              2017-08-17T12:44:20
              P1Y4DT12H44M372
           

       


I am trying to use xpaths to get all the occurences of '', I have tried many variation of xpaths including '//ChunkName', when I use log.info it only displays the first entry. it works when I specify which parent it is [1] or [2], but I want to be able to automatically capture all occurences. Is this possible?

Regards,

Moks

3 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    can you show the exact code you are running in your script to do this?

    regards,

    /Ole
    eviware.com
  • This is from the property Transfer action.

    declare namespace tim='http://www.reuters.com/ns/2007/10/25/webservices/TimeSeriesForCommonPlatform_1';
    //tim:TimeSeries_1_Response[1]/CachingBlock[1]//ChunkName[1]


    I am now trying to use a groovy script to start from 1 until that xpath returns a empty string.

    def response2 = context.expand( '${GetTimeSeries_1 - Request 1#Response#//CachingBlock[1]/CachingEntry[1]/ChunkName[1]}' )

    So replacing CachingEntry[n], buty having problems with putting this is an string due the # value.
  • I have been able to do this using Groovy script, but it would be nice to know if the same result can be achieved via the built in functionality, using property transfers