XML File with Different tag at same level
Posted: Tue May 05, 2009 7:54 am
Hi,
I have one xml file with Header and Trailer at the same level. The Detail records below the header maintain parent-child relationship.
Can anyone please guide me how to read and establish the parent-child relationship between those records. As the from date and tdate of the below file gets different for the same company code, I am not able to co-relate the records.
The <ZCOMMHDR> is the header tag and all <ZCOMMDET> is the detail record for that header.
The example of such file is as below:
<?xml version="1.0" encoding="utf-8"?>
<ZCOMMIT01 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<IDOC>
<ZCOMMHDR>
<ZCOMPANY>8442</ZCOMPANY>
<ZDCSITE>8442</ZDCSITE>
<ZSEASON>SM09</ZSEASON>
<ZFROMDATE>20090418</ZFROMDATE>
<ZTODATE>20090801</ZTODATE>
</ZCOMMHDR>
<ZCOMMDET>
<ZCOMPANY>8442</ZCOMPANY>
<ZARTICLE>T16 9076AY0 0500</ZARTICLE>
<ZCOMMIT_QTY>90</ZCOMMIT_QTY>
<ZBUILD_QTY>900</ZBUILD_QTY>
<ZEIP>28.80</ZEIP>
<ZCOMMIT_UNIT>EA</ZCOMMIT_UNIT>
</ZCOMMDET>
<ZCOMMDET>
<ZCOMPANY>8442</ZCOMPANY>
<ZARTICLE>T16 9075AT0 0100</ZARTICLE>
<ZCOMMIT_QTY>142</ZCOMMIT_QTY>
<ZBUILD_QTY>1421</ZBUILD_QTY>
<ZEIP>30.10</ZEIP>
<ZCOMMIT_UNIT>EA</ZCOMMIT_UNIT>
</ZCOMMDET>
<ZCOMPANY>9328</ZCOMPANY>
<ZDCSITE>9328</ZDCSITE>
<ZSEASON>SM09</ZSEASON>
<ZFROMDATE>20090509</ZFROMDATE>
<ZTODATE>20090822</ZTODATE>
</ZCOMMHDR>
<ZCOMMDET>
<ZCOMPANY>9328</ZCOMPANY>
<ZARTICLE>T41 2508 YZ 0600</ZARTICLE>
<ZCOMMIT_QTY>1400</ZCOMMIT_QTY>
<ZBUILD_QTY>14000</ZBUILD_QTY>
<ZEIP>3.65</ZEIP>
<ZCOMMIT_UNIT>EA</ZCOMMIT_UNIT>
</ZCOMMDET>
</IDOC>
</ZCOMMIT01>
Regards,
Pksahu
I have one xml file with Header and Trailer at the same level. The Detail records below the header maintain parent-child relationship.
Can anyone please guide me how to read and establish the parent-child relationship between those records. As the from date and tdate of the below file gets different for the same company code, I am not able to co-relate the records.
The <ZCOMMHDR> is the header tag and all <ZCOMMDET> is the detail record for that header.
The example of such file is as below:
<?xml version="1.0" encoding="utf-8"?>
<ZCOMMIT01 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<IDOC>
<ZCOMMHDR>
<ZCOMPANY>8442</ZCOMPANY>
<ZDCSITE>8442</ZDCSITE>
<ZSEASON>SM09</ZSEASON>
<ZFROMDATE>20090418</ZFROMDATE>
<ZTODATE>20090801</ZTODATE>
</ZCOMMHDR>
<ZCOMMDET>
<ZCOMPANY>8442</ZCOMPANY>
<ZARTICLE>T16 9076AY0 0500</ZARTICLE>
<ZCOMMIT_QTY>90</ZCOMMIT_QTY>
<ZBUILD_QTY>900</ZBUILD_QTY>
<ZEIP>28.80</ZEIP>
<ZCOMMIT_UNIT>EA</ZCOMMIT_UNIT>
</ZCOMMDET>
<ZCOMMDET>
<ZCOMPANY>8442</ZCOMPANY>
<ZARTICLE>T16 9075AT0 0100</ZARTICLE>
<ZCOMMIT_QTY>142</ZCOMMIT_QTY>
<ZBUILD_QTY>1421</ZBUILD_QTY>
<ZEIP>30.10</ZEIP>
<ZCOMMIT_UNIT>EA</ZCOMMIT_UNIT>
</ZCOMMDET>
<ZCOMPANY>9328</ZCOMPANY>
<ZDCSITE>9328</ZDCSITE>
<ZSEASON>SM09</ZSEASON>
<ZFROMDATE>20090509</ZFROMDATE>
<ZTODATE>20090822</ZTODATE>
</ZCOMMHDR>
<ZCOMMDET>
<ZCOMPANY>9328</ZCOMPANY>
<ZARTICLE>T41 2508 YZ 0600</ZARTICLE>
<ZCOMMIT_QTY>1400</ZCOMMIT_QTY>
<ZBUILD_QTY>14000</ZBUILD_QTY>
<ZEIP>3.65</ZEIP>
<ZCOMMIT_UNIT>EA</ZCOMMIT_UNIT>
</ZCOMMDET>
</IDOC>
</ZCOMMIT01>
Regards,
Pksahu