Parsing third-party XML

Posted by mare on Stack Overflow See other posts from Stack Overflow or by mare
Published on 2010-04-26T12:45:32Z Indexed on 2010/05/03 13:48 UTC
Read the original article Hit count: 558

Filed under:
|
|

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>

© Stack Overflow or respective owner

Related posts about .NET

Related posts about Xml