Reading multiple child element loop(independent loops)
I have a scenario of reading many child element, which is independent of each other.
The child element may or may not be in loop and there is no guarantee that all the child element will be present in every source loop.
Please find below the XML structure.
<entity id="10011">
<listId>1072</listId>
<listCode>AOE</listCode>
<addresses>
<address>
<city>AL-KARTUM</city>
<country>SD</country>
<countryName>SUDAN</countryName>
</address>
<address>
<city>AL-KHARTOUM</city>
<country>SD</country>
<countryName>SUDAN</countryName>
</address>
</addresses>
<dobs>
<dob D="19" M="12" Y="1969">12/19/1969</dob>
</dobs>
</entity>
<entity id="10012">
<listId>1008</listId>
<listCode>BG</listCode>
<pobs>
<pob>EAST LOMBOK, WEST NUSA TENGGARA, INDONESIA</pob>
<pob>INDIA</pob>
</pobs>
</entity>
Child elements to be extracted are <dob>, <pob>, <country> and <city>, which may or may not be in loop. Source loop is <entity>
Can any one help me in resolving this issue.
what You describe as issue?
it is normal situation - if element present XPATH query return value, if not - null, then You can parse this nulls and change it for anything like "N/A" or etc. For example if feature step required save DOB in date column - use ? expression for decide use or not dateFormat
this is not issue, this is advantages
Hi
vapukov/xdshi,
Thanks for your response. I think my problem is not well defined earlier.
Here is my expected result for the given XML.
ENTITY_ID DOB POB CITY COUNTRY_NAME
10011 12/19/1969 NULL AL-KARTUM SUDAN
10011 12/19/1969 NULL AL-KHARTOUM SUDAN
10012 NULL EAST LOMBOK, WEST NUSA TENGGARA, INDONESIA NULL NULL
The tags <dobs>, <pobs>, <city> , <country> will have multiple values. the parent loop should be
<entity> and the child loops are independent to each other. i.e. <dobs>, <pobs>, <city> , <country> can occur 'w' times,'x' times,'y' times,'z' times. And all the child element need not be present always. I used tXMLMap to fetch the values, but in that if I make all the child elements as loop element, I am not able to give the parent loop. If I give parent loop alone, I am not able to fetch all the values for child elements.
Please share your suggestions if any other component can be used to solve this problem.