Hello.
I have a problem to parse some very small xml file because of Datastage limit to define only 1 key in Input stage of xml.
This xml file has the following structure:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:DCSBAG_IdentifyBaggageReply xmlns:ns0="http://xml.amadeus.com/BIDBRR_08_2_1A">
<ns0:excessCalculationCharges>
<ns0:calculations>
<ns0:sectors>
<ns0:sectorOriginAndDestination>
<ns0:origin>TLV</ns0:origin>
<ns0:destination>KBP</ns0:destination>
</ns0:sectorOriginAndDestination>
<ns0:allowances>
<ns0:allowanceValue>
<ns0:checkedBaggageDetails>
<ns0:weight>40</ns0:weight>
<ns0:unitQualifier>K</ns0:unitQualifier>
</ns0:checkedBaggageDetails>
</ns0:allowanceValue>
<ns0:allowanceType>
<ns0:attributeDetails>
<ns0:attributeType>ADU</ns0:attributeType>
</ns0:attributeDetails>
</ns0:allowanceType>
</ns0:allowances>
<ns0:allowances>
<ns0:allowanceValue>
<ns0:checkedBaggageDetails>
<ns0:weight>6</ns0:weight>
<ns0:unitQualifier>K</ns0:unitQualifier>
</ns0:checkedBaggageDetails>
</ns0:allowanceValue>
<ns0:allowanceType>
<ns0:attributeDetails>
<ns0:attributeType>DIW</ns0:attributeType>
</ns0:attributeDetails>
</ns0:allowanceType>
</ns0:allowances>
</ns0:sectors>
</ns0:calculations>
</ns0:excessCalculationCharges>
</ns0:DCSBAG_IdentifyBaggageReply>
I need to load all these values into the table (or sequential file) The output that should be is
1st row:
TLV
KBP
40
K
ADU
2nd row:
TLV
KBP
6
K
DIW
But, when i choose AttributeType as a key, i receive an output:
1st row:
TLV
KBP
40
K
ADU
2nd row:
TLV
KBP
40
K
DIW
When i choose weight as a key, i receive
1st row:
TLV
KBP
40
K
ADU
2nd row:
TLV
KBP
6
K
ADU
And, if i try to read the xml twice (using 2 different links), i don't know how to collect them together...
Do you have any idea???
Thank you very much
XML Parsing
Moderators: chulett, rschirm, roy
This isn't a "limit" on DataStage --- it's not even a "key"....it's simply the trick that is used to identify to DataStage which "path" of repeating rows you are interested in for this link.
Without any additional knowledge about this document, it is incumbent upon you to know whether the lower groups repeat. In this case they appear to be singly occurring.
So....because both of your inner groups are singly appearing, you should have no issue using either one as a key. Of course, you have to be sure that in fact they are singly occuring.
I don't have access to 7.x anymore, but I just tried your exact example in 8.5, with the xmlInput Stage (same stage as in 7), and it works perfectly, getting exactly the two rows you are looking for, with either element as the "key" (repeating element).
Not sure about individual issues that might have existed in release 7....you might try adding the "allowances" element as a column and make it the only key. You can just ignore it downstream. Give it the same xpath as the others but end at ".../allowances/"
Ernie
Without any additional knowledge about this document, it is incumbent upon you to know whether the lower groups repeat. In this case they appear to be singly occurring.
So....because both of your inner groups are singly appearing, you should have no issue using either one as a key. Of course, you have to be sure that in fact they are singly occuring.
I don't have access to 7.x anymore, but I just tried your exact example in 8.5, with the xmlInput Stage (same stage as in 7), and it works perfectly, getting exactly the two rows you are looking for, with either element as the "key" (repeating element).
Not sure about individual issues that might have existed in release 7....you might try adding the "allowances" element as a column and make it the only key. You can just ignore it downstream. Give it the same xpath as the others but end at ".../allowances/"
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Give it a try and let us know how it goes....
......although this is something I've been doing since 7.0.0. Provided a node really only occurs one time, I've always been able to include it as part of the current "row" (meaning --- specify the repeating element in any of those sub-nodes because they all are singly occurring). Of course, all bets are off if any of the "actually" have multiple occurrences that are independent of the other.
Ernie
......although this is something I've been doing since 7.0.0. Provided a node really only occurs one time, I've always been able to include it as part of the current "row" (meaning --- specify the repeating element in any of those sub-nodes because they all are singly occurring). Of course, all bets are off if any of the "actually" have multiple occurrences that are independent of the other.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Hi, Guys. You are right. The xml i've published here does not show the problem i've talked about. The original XML is a little bit complicated. It is my mistake I've published only the part that is relevant and i did not check this part before.
Here is the original XML file:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:DCSBAG_IdentifyBaggageReply xmlns:ns0="http://xml.amadeus.com/BIDBRR_08_2_1A">
<ns0:excessCalculationCharges>
<ns0:responsibleCustomerUCI>
<ns0:idSection>
<ns0:referenceQualifier>UCI</ns0:referenceQualifier>
<ns0:primeId>001C54BD5847A084</ns0:primeId>
</ns0:idSection>
</ns0:responsibleCustomerUCI>
<ns0:calculations>
<ns0:statusIndicators>
<ns0:attributeDetails>
<ns0:attributeType>XSW</ns0:attributeType>
</ns0:attributeDetails>
</ns0:statusIndicators>
<ns0:xsbCalculationId>
<ns0:idSection>
<ns0:referenceQualifier>XCI</ns0:referenceQualifier>
<ns0:primeId>100000000029CDF8</ns0:primeId>
</ns0:idSection>
</ns0:xsbCalculationId>
<ns0:responsibleCustomerUPIs>
<ns0:idSection>
<ns0:referenceQualifier>DID</ns0:referenceQualifier>
<ns0:primeId>001C54BD5848B7FA</ns0:primeId>
</ns0:idSection>
</ns0:responsibleCustomerUPIs>
<ns0:dummySegmentOne/>
<ns0:totalCharges>
<ns0:monetaryDetails>
<ns0:typeQualifier>I</ns0:typeQualifier>
<ns0:amount>45</ns0:amount>
<ns0:currency>USD</ns0:currency>
</ns0:monetaryDetails>
<ns0:otherMonetaryDetails>
<ns0:typeQualifier>B</ns0:typeQualifier>
<ns0:amount>45</ns0:amount>
<ns0:currency>USD</ns0:currency>
</ns0:otherMonetaryDetails>
</ns0:totalCharges>
<ns0:waiverAuthorisation>
<ns0:freeTextQualification>
<ns0:textSubjectQualifier>3</ns0:textSubjectQualifier>
<ns0:language>EN</ns0:language>
</ns0:freeTextQualification>
<ns0:freeText>KSTEFANIANO HAND BAG</ns0:freeText>
</ns0:waiverAuthorisation>
<ns0:sectors>
<ns0:sectorOriginAndDestination>
<ns0:origin>TLV</ns0:origin>
<ns0:destination>KBP</ns0:destination>
</ns0:sectorOriginAndDestination>
<ns0:allowances>
<ns0:allowanceValue>
<ns0:checkedBaggageDetails>
<ns0:weight>40</ns0:weight>
<ns0:unitQualifier>K</ns0:unitQualifier>
</ns0:checkedBaggageDetails>
</ns0:allowanceValue>
<ns0:allowanceType>
<ns0:attributeDetails>
<ns0:attributeType>ADU</ns0:attributeType>
</ns0:attributeDetails>
</ns0:allowanceType>
</ns0:allowances>
<ns0:allowances>
<ns0:allowanceValue>
<ns0:checkedBaggageDetails>
<ns0:weight>6</ns0:weight>
<ns0:unitQualifier>K</ns0:unitQualifier>
</ns0:checkedBaggageDetails>
</ns0:allowanceValue>
<ns0:allowanceType>
<ns0:attributeDetails>
<ns0:attributeType>DIW</ns0:attributeType>
</ns0:attributeDetails>
</ns0:allowanceType>
</ns0:allowances>
</ns0:sectors>
</ns0:calculations>
</ns0:excessCalculationCharges>
</ns0:DCSBAG_IdentifyBaggageReply>
Here is the original XML file:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:DCSBAG_IdentifyBaggageReply xmlns:ns0="http://xml.amadeus.com/BIDBRR_08_2_1A">
<ns0:excessCalculationCharges>
<ns0:responsibleCustomerUCI>
<ns0:idSection>
<ns0:referenceQualifier>UCI</ns0:referenceQualifier>
<ns0:primeId>001C54BD5847A084</ns0:primeId>
</ns0:idSection>
</ns0:responsibleCustomerUCI>
<ns0:calculations>
<ns0:statusIndicators>
<ns0:attributeDetails>
<ns0:attributeType>XSW</ns0:attributeType>
</ns0:attributeDetails>
</ns0:statusIndicators>
<ns0:xsbCalculationId>
<ns0:idSection>
<ns0:referenceQualifier>XCI</ns0:referenceQualifier>
<ns0:primeId>100000000029CDF8</ns0:primeId>
</ns0:idSection>
</ns0:xsbCalculationId>
<ns0:responsibleCustomerUPIs>
<ns0:idSection>
<ns0:referenceQualifier>DID</ns0:referenceQualifier>
<ns0:primeId>001C54BD5848B7FA</ns0:primeId>
</ns0:idSection>
</ns0:responsibleCustomerUPIs>
<ns0:dummySegmentOne/>
<ns0:totalCharges>
<ns0:monetaryDetails>
<ns0:typeQualifier>I</ns0:typeQualifier>
<ns0:amount>45</ns0:amount>
<ns0:currency>USD</ns0:currency>
</ns0:monetaryDetails>
<ns0:otherMonetaryDetails>
<ns0:typeQualifier>B</ns0:typeQualifier>
<ns0:amount>45</ns0:amount>
<ns0:currency>USD</ns0:currency>
</ns0:otherMonetaryDetails>
</ns0:totalCharges>
<ns0:waiverAuthorisation>
<ns0:freeTextQualification>
<ns0:textSubjectQualifier>3</ns0:textSubjectQualifier>
<ns0:language>EN</ns0:language>
</ns0:freeTextQualification>
<ns0:freeText>KSTEFANIANO HAND BAG</ns0:freeText>
</ns0:waiverAuthorisation>
<ns0:sectors>
<ns0:sectorOriginAndDestination>
<ns0:origin>TLV</ns0:origin>
<ns0:destination>KBP</ns0:destination>
</ns0:sectorOriginAndDestination>
<ns0:allowances>
<ns0:allowanceValue>
<ns0:checkedBaggageDetails>
<ns0:weight>40</ns0:weight>
<ns0:unitQualifier>K</ns0:unitQualifier>
</ns0:checkedBaggageDetails>
</ns0:allowanceValue>
<ns0:allowanceType>
<ns0:attributeDetails>
<ns0:attributeType>ADU</ns0:attributeType>
</ns0:attributeDetails>
</ns0:allowanceType>
</ns0:allowances>
<ns0:allowances>
<ns0:allowanceValue>
<ns0:checkedBaggageDetails>
<ns0:weight>6</ns0:weight>
<ns0:unitQualifier>K</ns0:unitQualifier>
</ns0:checkedBaggageDetails>
</ns0:allowanceValue>
<ns0:allowanceType>
<ns0:attributeDetails>
<ns0:attributeType>DIW</ns0:attributeType>
</ns0:attributeDetails>
</ns0:allowanceType>
</ns0:allowances>
</ns0:sectors>
</ns0:calculations>
</ns0:excessCalculationCharges>
</ns0:DCSBAG_IdentifyBaggageReply>
At quick glance, it looks identical at the bottom, where it counts for the repetition element. I might have missed it on a quick look, but everything above it (the lower attribute nodes) appears to be unique, so the behavior should remain the same. I won't have time to try your larger example for a few days, but the structure appears conceptually the same.
Ernie
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Result
The output of the data you have given is on he similar line of the first one. The output in 8.1 is as you desired it to be:
referenceQualifier:UCI primeId:001C54BD5847A084 attributeType:XSW idSectionreferenceQualifier:XCI idSectionprimeId:100000000029CDF8 responsibleCustomerUPIsidSectionreferenceQualifier:DID responsibleCustomerUPIsidSectionprimeId:001C54BD5848B7FA dummySegmentOne:<ns0:dummySegmentOne xmlns:ns0="http://xml.amadeus.com/BIDBRR_08_2_1A"/> typeQualifier:I amount: 0000000045. currency:USD otherMonetaryDetailstypeQualifier:B otherMonetaryDetailsamount: 0000000045. otherMonetaryDetailscurrency:USD textSubjectQualifier: 0000000003. language:EN freeText:KSTEFANIANO HAND BAG origin:TLV destination:KBP weight: 0000000040. unitQualifier:K attributeDetailsattributeType:ADU
referenceQualifier:UCI primeId:001C54BD5847A084 attributeType:XSW idSectionreferenceQualifier:XCI idSectionprimeId:100000000029CDF8 responsibleCustomerUPIsidSectionreferenceQualifier:DID responsibleCustomerUPIsidSectionprimeId:001C54BD5848B7FA dummySegmentOne:<ns0:dummySegmentOne xmlns:ns0="http://xml.amadeus.com/BIDBRR_08_2_1A"/> typeQualifier:I amount: 0000000045. currency:USD otherMonetaryDetailstypeQualifier:B otherMonetaryDetailsamount: 0000000045. otherMonetaryDetailscurrency:USD textSubjectQualifier: 0000000003. language:EN freeText:KSTEFANIANO HAND BAG origin:TLV destination:KBP weight: 0000000006. unitQualifier:K attributeDetailsattributeType:DIW
referenceQualifier:UCI primeId:001C54BD5847A084 attributeType:XSW idSectionreferenceQualifier:XCI idSectionprimeId:100000000029CDF8 responsibleCustomerUPIsidSectionreferenceQualifier:DID responsibleCustomerUPIsidSectionprimeId:001C54BD5848B7FA dummySegmentOne:<ns0:dummySegmentOne xmlns:ns0="http://xml.amadeus.com/BIDBRR_08_2_1A"/> typeQualifier:I amount: 0000000045. currency:USD otherMonetaryDetailstypeQualifier:B otherMonetaryDetailsamount: 0000000045. otherMonetaryDetailscurrency:USD textSubjectQualifier: 0000000003. language:EN freeText:KSTEFANIANO HAND BAG origin:TLV destination:KBP weight: 0000000040. unitQualifier:K attributeDetailsattributeType:ADU
referenceQualifier:UCI primeId:001C54BD5847A084 attributeType:XSW idSectionreferenceQualifier:XCI idSectionprimeId:100000000029CDF8 responsibleCustomerUPIsidSectionreferenceQualifier:DID responsibleCustomerUPIsidSectionprimeId:001C54BD5848B7FA dummySegmentOne:<ns0:dummySegmentOne xmlns:ns0="http://xml.amadeus.com/BIDBRR_08_2_1A"/> typeQualifier:I amount: 0000000045. currency:USD otherMonetaryDetailstypeQualifier:B otherMonetaryDetailsamount: 0000000045. otherMonetaryDetailscurrency:USD textSubjectQualifier: 0000000003. language:EN freeText:KSTEFANIANO HAND BAG origin:TLV destination:KBP weight: 0000000006. unitQualifier:K attributeDetailsattributeType:DIW