Parsing third-party XML
- by mare
What path would you took to parse a large XML file (2MB - 20 MB or more), that does not have a schema (I cannot infer one with XSD.exe because the file structure is odd, check the snippet below)?
Options
1) XML Deserialization (but as said, I don't have a schema and XSD tool complains about the file contents),
2) Linq to XML,
3) loading into XmlDocument,
4) Manual parsing with XmlReader & stuff.
This is XML file snippet:
<?xml version="1.0" encoding="utf-8"?>
<xmlData date="29.04.2010 12:09:13">
<Table>
<ident>079186</ident>
<stock>0</stock>
<pricewotax>33.94000000</pricewotax>
<discountpercent>0.00000000</discountpercent>
</Table>
<Table>
<ident>079190</ident>
<stock>1</stock>
<pricewotax>10.50000000</pricewotax>
<discountpercent>0.00000000</discountpercent>
<pricebyquantity>
<Table>
<quantity>5</quantity>
<pricewotax>10.00000000</pricewotax>
<discountpercent>0.00000000</discountpercent>
</Table>
<Table>
<quantity>8</quantity>
<pricewotax>9.00000000</pricewotax>
<discountpercent>0.00000000</discountpercent>
</Table>
</pricebyquantity>
</Table>
</xmlData>