XML Input to capture repetition elements

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

XML Input to capture repetition elements

Post by reddy »

Hi,

I am trying to capture all the information including repetition elements from XML. I can only capture different values for the key element specified and for all the other elements i get repeated information same as the first record.

Example: Let us say this is my XML.

<customers>
<customer id="55000">
<name>Charter Group</name>
<address>
<street>100 Main</street>
<city>Framingham</city>
<state>MA</state>
<zip>01701</zip>
</address>
<address>
<street>720 Prospect</street>
<city>Boston</city>
<state>MA</state>
<zip>01210</zip>
</address>
<address>
<street>120 Ridge</street>
<city>waltham</city>
<state>MA</state>
<zip>01760</zip>
</address>
</customer>
</customers>

when i designate "/customers/customer/address/city/text()" as my repetition element i get the result as follows

55000,"Charter Group","100 Main","Framingham","MA","01701"
55000,"Charter Group","100 Main","Boston","MA","01701"
55000,"Charter Group","100 Main",Waltham,"MA","01701".

I am looking for a result like as follows

55000,"Charter Group","100 Main","Framingham","MA","01701"
55000,"Charter Group","720 Prospect","Boston","MA","01210"
55000,"Charter Group","120 Ridge",Waltham,"MA","01760"


Can anyone please help. Thanks in advance.

reddy
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

I can't even reproduce the same output that you got. Make sure the XPath in the output's Columns Description as follows:
/customers/customer/@id
/customers/customer/name/text()
/customers/customer/address/street/text()
/customers/customer/address/city/text()------key "yes"
/customers/customer/address/state/text()
/customers/customer/address/zip/text()

Good luck.
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

This is a sample xml. The actualu xml i am working is huge. I have imported the column definitions directly from teh schema file and i havent changed them.


reddy
Post Reply