XML Parsing using XML Stage
Posted: Wed Dec 18, 2013 12:09 pm
If I have the below XML that I need to parse and bring data up to the PONUMBER am I correct in saying that to do this using the XML Stage I have to have 2 separate links coming out of the stage where the one link would extract the <ReferenceInfo> data and the other link would extract the <MilestoneInfo> data because they are both at the same level under <LineItems><MilestoneMessage>? Then after I have the 2 separate outputs I can join them on the PONumber which is the parent of both so I now can get a record where the PONUmber and BLNumber will repeat for each MileStone I have like the output I show after the xml? Am I missing something where I don't have to have 2 output links to later join or can this be done in the XML Stage? Because this is just a sample. The real XML has a host of tags imbedded in it where many are at the same level as others and I'm thinking I have to have a bunch of files coming out of the stage to capture each one.
LineItems\MilestoneMessage\ReferenceInfo
LineItems\MilestoneMessage\MilestoneInfo\City
Output after join
PONUmber,BLNumber,MilestoneTypeCode,MilestoneTypeName,CityName
643730,3080951960,105,PO Accepted,Jiangsiu
643730,3080951960,11144,Supplier Booking Accepted,Shanghai
Code: Select all
- <LineItems>
<PONumber>643730</PONumber>
- <MilestoneMessage>
- <ReferenceInfo>
<ReferenceId reference="3080951960" type="BLNumber" />
</ReferenceInfo>
- <MilestoneInfo>
<MilestoneTypeCode>105</MilestoneTypeCode>
<MilestoneTypeName>PO Accepted</MilestoneTypeName>
- <City>
<CityName>Jiangsiu</CityName>
</City>
</MilestoneInfo>
- <MilestoneInfo>
<MilestoneTypeCode>11144</MilestoneTypeCode>
<MilestoneTypeName>Supplier Booking Accepted</MilestoneTypeName>
- <City>
<CityName>Shanghai</CityName>
</City>
</MilestoneInfo>
</MilestoneMessage>
</LineItems>
LineItems\MilestoneMessage\MilestoneInfo\City
Output after join
PONUmber,BLNumber,MilestoneTypeCode,MilestoneTypeName,CityName
643730,3080951960,105,PO Accepted,Jiangsiu
643730,3080951960,11144,Supplier Booking Accepted,Shanghai