I've already read some posts and articles on how to deserialize xml but still haven't figured out the way I should write the code to match my needs, so.. I'm apologizing for another question about deserializing xml )) I have a large (50 MB) xml file which I need to deserialize. I use xsd.exe to get xsd schema of the document and than autogenerate c# classes file which I put into my project. I want to get some (not all) data from this xml file and put it into my sql database. Here is the hierarchy of the file (simplified, xsd is very large): \[code\]public class yml_catalog { public yml_catalogShop[] shop { /*realization*/ }}public class yml_catalogShop{ public yml_catalogShopOffersOffer[][] offers { /*realization*/ }}public class yml_catalogShopOffersOffer{ // here goes all the data (properties) I want to obtain ))}\[/code\]And here is my code: first approach: \[code\]yml_catalogShopOffersOffer catalog;var serializer = new XmlSerializer(typeof(yml_catalogShopOffersOffer));var reader = new StreamReader(@"C:\div_kid.xml");catalog = (yml_catalogShopOffersOffer) serializer.Deserialize(reader);//exception occuresreader.Close();\[/code\]I get InvalidOperationException: There is an error in the XML(3,2) documentsecond approach:\[code\]XmlSerializer ser = new XmlSerializer(typeof(yml_catalogShopOffersOffer));yml_catalogShopOffersOffer result;using (XmlReader reader = XmlReader.Create(@"C:\div_kid.xml")) { result = (yml_catalogShopOffersOffer)ser.Deserialize(reader); // exception occures}\[/code\]InvalidOperationException: There is an error in the XML(0,0) documentthird: I tried to deserialize the entire file: \[code\] XmlSerializer ser = new XmlSerializer(typeof(yml_catalog)); // exception occures yml_catalog result; using (XmlReader reader = XmlReader.Create(@"C:\div_kid.xml")) { result = (yml_catalog)ser.Deserialize(reader); }\[/code\]And I get the following: \[code\]error CS0030: The convertion of type "yml_catalogShopOffersOffer[]" into "yml_catalogShopOffersOffer" is not possible.error CS0029: The implicit convertion of type "yml_catalogShopOffersOffer" into "yml_catalogShopOffersOffer[]" is not possible.\[/code\]So, how to fix (or overwrite) the code to not get the exceptions?edits: Also when I write: \[code\]XDocument doc = XDocument.Parse(@"C:\div_kid.xml");\[/code\]The XmlException occures: unpermitted data on root level, string 1, position 1.Here is the first string of the xml file: \[code\]<?xml version="1.0" encoding="windows-1251"?>\[/code\]