Eviware Forum

soapUI => soapUI => Topic started by: mohbubur rahman on May 09, 2008, 05:59:44 am



Title: Multiple Child elements
Post by: mohbubur rahman on May 09, 2008, 05:59:44 am
Hi,

I have a response of the followin;

<CachingBlock>
            <CachingEntry>
               <ChunkPrefix>arce sceptra</ChunkPrefix>
               <ChunkName>circum claustra fremunt</ChunkName>
               <ChunkStartTime>2017-08-17T12:44:20</ChunkStartTime>
               <ChunkDuration>P1Y4DT12H44M37S</ChunkDuration>
            </CachingEntry>
            <CachingEntry>
               <ChunkPrefix>arce sceptra2</ChunkPrefix>
               <ChunkName>circum claustra fremunt2</ChunkName>
               <ChunkStartTime>2017-08-17T12:44:20</ChunkStartTime>
               <ChunkDuration>P1Y4DT12H44M372</ChunkDuration>
            </CachingEntry>
         </CachingBlock>

I am trying to use xpaths to get all the occurences of '<ChunkName>', 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


Title: Re: Multiple Child elements
Post by: omatzura on May 09, 2008, 02:01:46 pm
Hi!

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

regards,

/Ole
eviware.com


Title: Re: Multiple Child elements
Post by: mohbubur rahman on May 12, 2008, 03:20:50 am
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.


Title: Re: Multiple Child elements
Post by: mohbubur rahman on May 12, 2008, 04:56:30 am
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