Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 15, 2013 10:38 PM by Mikesdotnetting
Member
1 Points
6 Posts
Feb 15, 2013 04:02 PM|LINK
I am getting the following error if i try to upload an XML document."An unhandled exception of type 'System.OutOfMemoryException' occurred in mscorlib.dll".
XmlDocument objXmlDoc = new XmlDocument(); objXmlDoc.Load(@"source");
the Xml file is more than 1gb
How to over come this problem?
All-Star
154818 Points
19853 Posts
Moderator
MVP
Feb 15, 2013 10:38 PM|LINK
You need to use an XmlReader and feed the document in as a stream: http://msdn.microsoft.com/en-us/library/756wd7zs.aspx
You can use the XElement.Load method that accepts an XmlReader to load specific nodes, and then query them using LINQ: http://msdn.microsoft.com/en-us/library/bb538300.aspx
abhilash gad...
Member
1 Points
6 Posts
How can i Load a large XML file ?
Feb 15, 2013 04:02 PM|LINK
I am getting the following error if i try to upload an XML document."An unhandled exception of type 'System.OutOfMemoryException' occurred in mscorlib.dll".
XmlDocument objXmlDoc = new XmlDocument();
objXmlDoc.Load(@"source");
the Xml file is more than 1gb
How to over come this problem?
Mikesdotnett...
All-Star
154818 Points
19853 Posts
Moderator
MVP
Re: How can i Load a large XML file ?
Feb 15, 2013 10:38 PM|LINK
You need to use an XmlReader and feed the document in as a stream: http://msdn.microsoft.com/en-us/library/756wd7zs.aspx
You can use the XElement.Load method that accepts an XmlReader to load specific nodes, and then query them using LINQ: http://msdn.microsoft.com/en-us/library/bb538300.aspx
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter