How to process XML file with repetitive elements using the X
Posted: Thu Nov 28, 2013 12:50 pm
Hi All,
I have the following XML file and need to convert the XML data into reguler records.
<Emp>
<EmpName>XYZ</EmpName>
<Phonenumber>12345</phonenumber>
<phonenumber>56789</phonenumber>
<email>xyz@xyz.com</email>
<email>abc@abc.com</email>
</Emp>
All the data belongs to one single employee. no restriction on number of phone numbers and mail ids.I need to convert this data into as below.
EmpName,phonenumber,email
xyz,12345,xyz@xyz.com
xyz,12345,abc@abc.com
xyz,56789,xyz@xyz.com
xyz,56789,abc@abc.com
I have designed a job like XML Stage ------- > Seq File Stage. In XML stage I have used XML parser and imported the respective xsd file also. But as an output i am getting one single record like "xyz,12345,xyz@xyz.com". To get the required output i have used switch in the XML stage and i have done some kind of analysis also. But I did not get the required output. Can anybody suggest me how to achive this. What are all properties i need to use in XML satge? can we achieve this using XML stage?
Anybody have any doc please share with me.
Thanks !
I have the following XML file and need to convert the XML data into reguler records.
<Emp>
<EmpName>XYZ</EmpName>
<Phonenumber>12345</phonenumber>
<phonenumber>56789</phonenumber>
<email>xyz@xyz.com</email>
<email>abc@abc.com</email>
</Emp>
All the data belongs to one single employee. no restriction on number of phone numbers and mail ids.I need to convert this data into as below.
EmpName,phonenumber,email
xyz,12345,xyz@xyz.com
xyz,12345,abc@abc.com
xyz,56789,xyz@xyz.com
xyz,56789,abc@abc.com
I have designed a job like XML Stage ------- > Seq File Stage. In XML stage I have used XML parser and imported the respective xsd file also. But as an output i am getting one single record like "xyz,12345,xyz@xyz.com". To get the required output i have used switch in the XML stage and i have done some kind of analysis also. But I did not get the required output. Can anybody suggest me how to achive this. What are all properties i need to use in XML satge? can we achieve this using XML stage?
Anybody have any doc please share with me.
Thanks !