Page 1 of 1

how to handle missing tags xml file ?

Posted: Mon Aug 06, 2012 10:51 am
by synsog
The tags in red are not coming from input XML file, sometimes they come and sometimes they wont come. This is a example, not particularly a contact will not come,, some times limit tags may come may not come. How to handle the xml parsing int his situation ????

If XML file is like below;

<ns7:type>Liability</ns7:type>
- <ns7:Coverages>
- <ns7:Coverage>
<ns7:type>Road Coverage</ns7:type>
<ns7:effectiveFromDate>2012-03-21-04:00</ns7:effectiveFromDate>
<ns7:effectiveToDate>2013-03-21-04:00</ns7:effectiveToDate>
<ns7:description>$50,000/100,000</ns7:description>
- <ns7:Limits>
- <ns7:Limit>
<ns8:amount>100000</ns8:amount>
<ns7:limitType>Incident</ns7:limitType>
</ns7:Limit>
- <ns7:Limit>
<ns8:amount>50000</ns8:amount>
<ns7:limitType>Person</ns7:limitType>
</ns7:Limit>
</ns7:Limits>
- <ns7:Premiums>
- <ns9:Premium>
- <ns9:AnnualPremium>
- <ns9:Amount>
<ns8:amount>700.00</ns8:amount>
</ns9:Amount>
</ns9:AnnualPremium>
- <ns9:NetPremium>
- <ns9:Amount>
<ns8:amount>700.00</ns8:amount>
</ns9:Amount>
</ns9:NetPremium>
- <ns9:NetOnBooksPremium>
- <ns9:Amount>
<ns8:amount>700.00</ns8:amount>
</ns9:Amount>
</ns9:NetOnBooksPremium>
</ns9:Premium>

</ns9:QuoteOption>
</ns9:QuoteOptions>

Posted: Mon Aug 06, 2012 11:47 am
by chulett
So... you are saying that sometimes the elements in red may not exist in the file? I don't recall that being a problem. What exactly do you mean by it is "not able to parse incomplete file"? What error(s) are you getting?

Posted: Mon Aug 06, 2012 12:50 pm
by synsog
Yes, they may exists or may not exists; I am getting the fatal errors as below;

xmlSrcReadXmlFile,0: Caught unknown exception from runLocally().
xmlSrcReadXmlFile,0: The runLocally() of the operator failed.
xmlSrcReadXmlFile,0: Operator terminated abnormally: runLocally() did not return APT_StatusOk

Posted: Mon Aug 06, 2012 1:49 pm
by hellboy
It should not be any problem , just define all the tags properly and try to uncheck the initial validation option ... it will parse the file properly , datastage treats unavailable tags as optional tag and put blank in the respective column.

Regards

Posted: Mon Aug 06, 2012 1:54 pm
by chulett
What exact 8.x version do you have and are you current on fixpacks / patches / whatever? And for grins, please confirm that when nothing is missing from the file you do not get any errors.

Posted: Tue Aug 07, 2012 7:28 am
by synsog
Hi, In XML INPUT Stage , under Stage tab - Validate input XML box is unchecked only, I defined all the tags properly .. around 450 xml files are parsing successfully, only the xml files which donot have all tags are failing. I defined the columns as Nullable No;

Posted: Tue Aug 07, 2012 7:31 am
by synsog
Chulett: This is 8.7v; Yes, around 450 xml's are processing successfully without any single warning/error, only few xml files, where the tags are missing are getting faling.

Posted: Tue Aug 07, 2012 7:17 pm
by eostic
there's not enough of a chunk there....the coverages element didn't seem to close....

nevertheless, in this screen shot of xml, there are clearly multiple independent paths ...one for limits perhaps, and another for premiums? I can't tell because it doesn't look like a complete xml and it's only a screen shot from a browser (notice the dashes) and not the actual xml itself.

Handling nulls is something that is done at both the base level for a row and also at the repeating group....and it depends on the repetition element setting.

let's keep reviewing...it's more complicated than what has been outlined so far.

Ernie