how to handle missing tags xml file ?
Posted: Mon Aug 06, 2012 10:51 am
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>
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>