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.
<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?
Solved! Go to Solution.
It is understand there is some customization.
But how it is working with default behaviour when you tried?
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.
You can write script in what ever way you wanted.
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.
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.
Community and Education Specialist
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: