I got an URGENT to solve problem here:
We become a deeply nested XML structure from an external API. Sort like:
<wbs>[0]
…name0[0]
…name0[1]
…name0[2]
…<wbs>[1]
…name1[0]
…name1[1]
…name1[2]
…<wbs>[2]
…name2[0]
…name2[1]
…<wbs>[3]
…name3[0]
In each nesting I need to extract the field ‘name’. We do not know, how deep the nesting will be, so I could not biuld a static loop nesting.
Anybody got a clue in how to handle this?
You can also do recursion in flow, so the approach below should work:
SERVICE recurseXX takes ‘record’ input
IF EXIT CONDITION…
BRANCH on /WBS
MAP name1, name2, etc…
MAP /WBS/WBS -> tempRecord
INVOKE recurseXX with ‘tempRecord’->‘record’
MAP results
One thing I would be careful while doing recursion (in Java, or in Flow) about is stack overflow. I think a default IS install can do about 60 nested levels of recursion in flow before overflowing the stack. Rohit’s Java service may be more efficient in this regard. The Java stack size can be increased on startup - it is the -Xss flag I think.