S
Sudip_inn
Guest
this is my xml
<?xml version="1.0" encoding="utf-8"?>
<TickerBrokerDateLineItemMap>
<TickerBrokerDateLineItem>
<BrokerLineItemName>SAN DIMAS (Stream - Ag - First Majestic - Durango, MEX)</BrokerLineItemName>
<StandardDate>1Q 2014A</StandardDate>
<BrokerDate>
<Year>1Q 2014</Year>
<Quarter />
</BrokerDate>
<ColumnCoordinate>16</ColumnCoordinate>
<LineItemDateValue></LineItemDateValue>
<RowCoordinate>7</RowCoordinate>
</TickerBrokerDateLineItem>
<TickerBrokerDateLineItem>
<BrokerLineItemName>Project Operation Schedule</BrokerLineItemName>
<StandardDate>1Q 2014A</StandardDate>
<BrokerDate>
<Year>1Q 2014</Year>
<Quarter />
</BrokerDate>
<ColumnCoordinate>16</ColumnCoordinate>
<LineItemDateValue></LineItemDateValue>
<RowCoordinate>8</RowCoordinate>
</TickerBrokerDateLineItem>
</TickerBrokerDateLineItemMap>
private void Button1_Click(object sender, EventArgs e)
{
string path = @"C:\Users\Tridip\source\repos\xmldeserialization\testxml.xml";
TickerBrokerDateLineItemMapCollection _TickerBrokerDateLineItemMapCollection = null;
XmlSerializer serializer = new XmlSerializer(typeof(TickerBrokerDateLineItemMapCollection));
StreamReader reader = new StreamReader(path);
_TickerBrokerDateLineItemMapCollection = (TickerBrokerDateLineItemMapCollection)serializer.Deserialize(reader);
reader.Close();
}
[Serializable()]
[System.Xml.Serialization.XmlRoot("TickerBrokerDateLineItemMapCollection")]
public class TickerBrokerDateLineItemMapCollection
{
[System.Xml.Serialization.XmlArray("TickerBrokerDateLineItemMap")]
[System.Xml.Serialization.XmlArrayItem("TickerBrokerDateLineItem", typeof(TickerBrokerDateLineItem))]
public TickerBrokerDateLineItem[] TickerBrokerDateLineItem { get; set; }
}
[Serializable()]
public class TickerBrokerDateLineItem
{
[System.Xml.Serialization.XmlElement("BrokerLineItemName")]
public string BrokerLineItemName { get; set; }
[System.Xml.Serialization.XmlElement("StandardDate")]
public string StandardDate { get; set; }
[System.Xml.Serialization.XmlElement("BrokerDate")]
public BrokerDate BrokerDate { get; set; }
}
[Serializable()]
public class BrokerDate
{
[System.Xml.Serialization.XmlElement("Year")]
public string Year { get; set; }
[System.Xml.Serialization.XmlElement("Quarter")]
public string Quarter { get; set; }
}
Continue reading...
<?xml version="1.0" encoding="utf-8"?>
<TickerBrokerDateLineItemMap>
<TickerBrokerDateLineItem>
<BrokerLineItemName>SAN DIMAS (Stream - Ag - First Majestic - Durango, MEX)</BrokerLineItemName>
<StandardDate>1Q 2014A</StandardDate>
<BrokerDate>
<Year>1Q 2014</Year>
<Quarter />
</BrokerDate>
<ColumnCoordinate>16</ColumnCoordinate>
<LineItemDateValue></LineItemDateValue>
<RowCoordinate>7</RowCoordinate>
</TickerBrokerDateLineItem>
<TickerBrokerDateLineItem>
<BrokerLineItemName>Project Operation Schedule</BrokerLineItemName>
<StandardDate>1Q 2014A</StandardDate>
<BrokerDate>
<Year>1Q 2014</Year>
<Quarter />
</BrokerDate>
<ColumnCoordinate>16</ColumnCoordinate>
<LineItemDateValue></LineItemDateValue>
<RowCoordinate>8</RowCoordinate>
</TickerBrokerDateLineItem>
</TickerBrokerDateLineItemMap>
private void Button1_Click(object sender, EventArgs e)
{
string path = @"C:\Users\Tridip\source\repos\xmldeserialization\testxml.xml";
TickerBrokerDateLineItemMapCollection _TickerBrokerDateLineItemMapCollection = null;
XmlSerializer serializer = new XmlSerializer(typeof(TickerBrokerDateLineItemMapCollection));
StreamReader reader = new StreamReader(path);
_TickerBrokerDateLineItemMapCollection = (TickerBrokerDateLineItemMapCollection)serializer.Deserialize(reader);
reader.Close();
}
[Serializable()]
[System.Xml.Serialization.XmlRoot("TickerBrokerDateLineItemMapCollection")]
public class TickerBrokerDateLineItemMapCollection
{
[System.Xml.Serialization.XmlArray("TickerBrokerDateLineItemMap")]
[System.Xml.Serialization.XmlArrayItem("TickerBrokerDateLineItem", typeof(TickerBrokerDateLineItem))]
public TickerBrokerDateLineItem[] TickerBrokerDateLineItem { get; set; }
}
[Serializable()]
public class TickerBrokerDateLineItem
{
[System.Xml.Serialization.XmlElement("BrokerLineItemName")]
public string BrokerLineItemName { get; set; }
[System.Xml.Serialization.XmlElement("StandardDate")]
public string StandardDate { get; set; }
[System.Xml.Serialization.XmlElement("BrokerDate")]
public BrokerDate BrokerDate { get; set; }
}
[Serializable()]
public class BrokerDate
{
[System.Xml.Serialization.XmlElement("Year")]
public string Year { get; set; }
[System.Xml.Serialization.XmlElement("Quarter")]
public string Quarter { get; set; }
}
Continue reading...