Last post Jul 17, 2015 01:58 AM by Zhi Lv - MSFT
Jul 16, 2015 12:59 PM|kamalchhabra|LINK
I have xml file, which can be goes upto 2GB.
i want to convert that xml file to dataset. i am using below code
DataSet ds = new DataSet();
that gives me error
"exception of type 'system.outofmemoryexception' was thrown".
Please suggest me.
Jul 16, 2015 04:28 PM|DeadTroll|LINK
2GB is an awful lot. You may want to try and only select out of it what you need at time. Reading it directly into an XDocument and then using Linq To XML to reduce the size before pushing it into a Dataset.
Also you could just create object models of your XML and use it that way. You can create those models very quickly via a few command line commands. Here is an article that will walk you through that process http://www.diaryofaninja.com/blog/2010/05/07/make-your-xml-stronglytyped-because-you-can-and-its-easy
Jul 17, 2015 01:58 AM|Zhi Lv - MSFT|LINK
As for this issue, your xml file is too large. I suggest you could read this xml file using XMLReader or LINQ to XML.
Here are some relevant articles, please refer to them:
Using LINQ to XML:
Besides, you could also try to split the large xml file into smaller partitions.