Multi level nested loops


My document structure is->
Orders [ DocumentList - 0 or more]
Palette [ DocumentList - 0 or more]
Lpn [ DocumentList - 0 or more]
LpnDetails [ DocumentList - 0 or more]
LpnItemAttributes [Record]

Now, I’m looping as follows:
Loop /Orders
Loop /Orders/Palette
Loop /Orders/Palette/Lpn
Loop /Orders/Palette/Lpn/LpnDetails
Perform mapping of LpnItemAttributes

This works fine as long as each of Orders, Palette, Lpn, LpnDetails have multiple records.

But suppose I’ve following structure.
Orders [6 records]
Palette [1 record]
Lpn [ 1 record]
LpnDetails [1 record]

It loops only through Orders and doesn’t loop through others for LpnItemAttributes mapping.
I’m passing xml data as string and converting to node then document.
That time Palette, Lpn and LpnDetails are not getting converted to seingle record list. But get converted to single record.

Any solution?


xmlNodeToDocument has the facility to specify arrays parameter wherein you can specify names of elements to appear as arrays irrespective of how many times they occur.

Sorry for the oversight.

1 Like