Here's the XSD:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="xmlData">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="ident" type="xs:int" />
<xs:element name="stock" type="xs:int" />
<xs:element name="pricewotax" type="xs:double" />
<xs:element name="discountpercent" type="xs:double" />
<xs:element minOccurs="0" name="pricebyquantity">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="quantity" type="xs:int" />
<xs:element name="pricewotax" type="xs:double" />
<xs:element name="discountpercent" type="xs:double" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="date" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>
Here's the serializable class:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3603
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
//
// This source code was auto-generated by xsd, Version=2.0.50727.1432.
//
namespace StockInfo {
using System.Xml.Serialization;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class xmlData {
private xmlDataTable[] tableField;
private string dateField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Table")]
public xmlDataTable[] Table {
get {
return this.tableField;
}
set {
this.tableField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string date {
get {
return this.dateField;
}
set {
this.dateField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class xmlDataTable {
private int identField;
private int stockField;
private double pricewotaxField;
private double discountpercentField;
private xmlDataTableTable[] pricebyquantityField;
/// <remarks/>
public int ident {
get {
return this.identField;
}
set {
this.identField = value;
}
}
/// <remarks/>
public int stock {
get {
return this.stockField;
}
set {
this.stockField = value;
}
}
/// <remarks/>
public double pricewotax {
get {
return this.pricewotaxField;
}
set {
this.pricewotaxField = value;
}
}
/// <remarks/>
public double discountpercent {
get {
return this.discountpercentField;
}
set {
this.discountpercentField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayItemAttribute("Table", IsNullable=false)]
public xmlDataTableTable[] pricebyquantity {
get {
return this.pricebyquantityField;
}
set {
this.pricebyquantityField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class xmlDataTableTable {
private int quantityField;
private double pricewotaxField;
private double discountpercentField;
/// <remarks/>
public int quantity {
get {
return this.quantityField;
}
set {
this.quantityField = value;
}
}
/// <remarks/>
public double pricewotax {
get {
return this.pricewotaxField;
}
set {
this.pricewotaxField = value;
}
}
/// <remarks/>
public double discountpercent {
get {
return this.discountpercentField;
}
set {
this.discountpercentField = value;
}
}
}
}
One caveat: deserializing may not be the most performant way to parse a 20MB file. XmlReader is likely the fastest way to do it, but that means doing things manually.