Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] tXMLMap loop through root and child nodes.

Hello,
I have a problem regarding loops in tXMLMap. Since TXmlMap doesnt allow to have a loop on both root and child elements, I cant seem to figure out the way to complete my task. I need to send payload to tESBProviderResponse with same schema as a response from a web service. I marked the elements that should be looped through in the image, and also provided with a way my response should look like.
LINK TO THE IMAGE: http://postimg.org/image/g7hjsv7gf/full/
Can anyone link me to a tutorial on that would solve this problem, or supply me with a solution?
Thank you in advance,
Algimantas
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Solved this problem by simply using tMap instead of tXMLMap and just threw the payload i get from tESBConsumer straight to tESBResponse, thus skipping the mapping part where i had to deal with multiloops.

View solution in original post

10 Replies
willm1
Creator
Creator

spiderman - if you've not solved your issue yet, I'm wondering if you've tried the tFileOutputMSXML component that allows for looping at parent and child nodes?
Anonymous
Not applicable
Author

havent solved it yet. As i said i need to send a payload i receiver from TESBConsumer to tESBProviderResponse componet, not to a file.
Anonymous
Not applicable
Author

Solved this problem by simply using tMap instead of tXMLMap and just threw the payload i get from tESBConsumer straight to tESBResponse, thus skipping the mapping part where i had to deal with multiloops.
Anonymous
Not applicable
Author

I just want to know how did you solve this with tmap. Did you join the two loop results using tmap?
I need help here.
Thanks,
suviga
Anonymous
Not applicable
Author

For future reference, the tExtractXMLField component is very useful when trying to extract data from XML with nested loops. But I guess as you simply want to pass from the input to output, you do not need to extract the data and rebuild it 🙂
Suviga, he didn't extract any data. He simply passed the data as a Document through the tMap. If you want to extract data from nested loops, then look at the tExtractXMLField component. You will also need to look at XPath queries to get the best use out of this.
Anonymous
Not applicable
Author

rhel, I think my scenario is completely different.
<root>
<items>
</item>
</item>
</items>
<places>
</place>
</place>
</places>
</root>
I am able to set loop in both  item and place (since they are in same level)  using tXMLMap
But if I want one more loop at a city node(which is a child of  place)
<root>
<items>
</item>
</item>
</items>
<places>
<place>
<cities>
</city>
</city>
</cities>
</place>
<place>
<cities>
</city>
</city>
</cities>
</place>
</places>
</root>
I am not able to achieve this as loops can't be set both at parent and child level.
Note: Link to references if any will be helpful as I am very new to Talend
Anonymous
Not applicable
Author

And also for your information I have to do a lot of transformation & filtering on these  loops,It is not just simple mapping.
Anonymous
Not applicable
Author

Take a look at the tExtractXMLField component. You can use these components in combination to extract multiple loops (nested as well), but it takes a little work. I don't have any links to demonstrate this I am afraid. But your question has got me thinking about a good tutorial to write 🙂
Consider extracting the elements containing looped data as "nodes" using the tExtractXMLField component. Then pass those nodes to subsequent tExtractXMLField components to extract the detail data from those nodes. Take a look at the Talend documentation on the component to see how this is done. 
I will put together a tutorial on this and when it is online I will share the link.
Anonymous
Not applicable
Author

Thanks a lot rhall for your faster replies  0683p000009MACn.png.Will try with  tExtractXMLField