XML Mapper Issue

I’m trying to create a mapper for an XML file. Within the XML there are nested element, the below shows the data and the steps I have so far.

I’ve repeated on the iSummary and I’m getting 2 detail records which are fine, but the iVatSummary line could be multiple, so I’ve put another repeat in but it’s putting both of the VAT Summary lines into the same group.

I want the iVATSummary to be linked to each iSummary line, so in the above instance each should just have 1 detail line. Any ideas on how I achieve this?

Can you also please share an screenshot of the properties of the Extraction1 and Extration2 Extract Steps? I assume that you need to update the properties of one these two Extract Steps.

Sorry someone rebooted the server and I’ve lost everything so I’ve started again but I can’t get anything in the VATSummaryLine now. Do I need the goto here? Screen shots below of various steps

I think your issue is with the various Xpath statements you are using within each loop.

Remember that when you loop, for instance on <element>, then extracting the <subelement> child nodes from that element is done through ./subelement, where the dot refers to the current element (in a loop, this changes to the next <element> with each iteration.

Attached is a sample config NestedElements.OL-datamapper (9.3 KB) that iterates through all <invoice> elements and for each, extracts <item> child elements. Perhaps you can use it as inspiration for your own configuration.

@Phil thanks for that. I’ve had a look and made some changes but it’s still not working. It’s nothing to do with the fact that there are some nested elements before the main element start’s is it, because if I don’t add the goto then the repeat doesn’t work?

I’ve also noticed that in the first loop I have to put …/iSummary rather than ./iSummary otherwise the first repeat doesn’t work?

I’ve created dummy data and attached the mapper if that helpsSample_XML.OL-datamapper (6.4 KB)

Your inner loop is incorrect: it iterates on ./iVatSummaryLine when it should in fact iterate on ./iVatSummary/iVatSummaryLine.

In addition, you don’t need a Goto step prior to your first loop, since the XPath selector does all that for you.

Here’s a simplified version of your sample. Simplified_Sample_XML.OL-datamapper (7.4 KB)

Perfect thanks so much as always Phil