cancel
Showing results for 
Search instead for 
Did you mean: 

How to map repeating elements from xml response to datasink

SOLVED
Highlighted
Occasional Contributor

How to map repeating elements from xml response to datasink

I've been scouring the doc, and I can't seem to find a good answer here. 

 

Is there a way to map a repeating element from a response into a datasink automatically, rather than having to click getData and manually clicking each one?

 

So, if I have 25 repeating elements. Widgets again. They all have the same attributes. A1, A2, A3. I want my sink to collect each of the attributes from each of the widgets, but I don't want to have to map it explicitly in the data sink property and the every one of the 25 widgets (x3 attributes) in my response.

 

example: 

<widgets>
    <widget>
         <att1>abc</att1>
         <att2>xyz</att2>
         <att3>asd</att3>
     </widget>
    <widget>
         <att1>abc</att1>
         <att2>xyz</att2>
         <att3>asd</att3>
     </widget>
...
</widgets>

 

In my datasink, I'd like to map these out 1 element to 1 row in excel: 

excel row 1 (first widget): att1: abc, att2: xyz, att1: asd 

excel row 2 (second widget): att2: abc, att2: xyz, att1: asd 

 

Is there a way to do that? 

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Occasional Contributor

Re: How to map repeating elements from xml response to datasink

@sonya_m @nmrao 

 

https://community.smartbear.com/t5/ReadyAPI-Feature-Requests/Excel-datasink-to-consume-repeating-xml...

 

I've added a feature request. I wasn't sure if I was using the tool correctly, or if I needed to request an enhancement; either way, I put it in!  If someone is reading this, please go upvote the feature. 😉 

 

Other similar issues: 

 

 

  •  

View solution in original post

6 REPLIES 6
Highlighted
Community Hero

Re: How to map repeating elements from xml response to datasink

Never tried/used data sink.

It is understand there is some customization.
But how it is working with default behaviour when you tried?


Regards,
Rao.
Highlighted
Occasional Contributor

Re: How to map repeating elements from xml response to datasink

It's currently just pulling the first widget. Because you have to click, get data, and point to the first widget's attributes to map it to the column in excel. It seems that it'd be a common use case to have repeating elements. I did import a schema for the response, and with the schema, it would know that there are repeats. 

 

I'm guessing I need to write custom groovy to do it.

Highlighted
Community Hero

Re: How to map repeating elements from xml response to datasink

You are correct by saying that it is common to have repeated elements in the GET response. However, some are ok with default behaviour and you wanted it probably different.
You can write script in what ever way you wanted.


Regards,
Rao.
Highlighted
Occasional Contributor

Re: How to map repeating elements from xml response to datasink

@nmrao 

 

Yeah, I was trying to get around having to write script. I know you can just use a xml map in excel and hit import, but I don't want to do that step manually. Was hoping there was a similar feature. 

Highlighted
Community Manager

Re: How to map repeating elements from xml response to datasink

Hi @tadudek!

 

If there's any behavior you would like to see in the tool that isn't already there, feel free to create a feature request here.  

When you do that, it would be great if you add the link to it to this thread as well so that more people see the request and vote it up. 


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Occasional Contributor

Re: How to map repeating elements from xml response to datasink

@sonya_m @nmrao 

 

https://community.smartbear.com/t5/ReadyAPI-Feature-Requests/Excel-datasink-to-consume-repeating-xml...

 

I've added a feature request. I wasn't sure if I was using the tool correctly, or if I needed to request an enhancement; either way, I put it in!  If someone is reading this, please go upvote the feature. 😉 

 

Other similar issues: 

 

 

  •  

View solution in original post

New Here?
Join us and watch the welcome video:
Top Kudoed Authors