Click here to Skip to main content
16,017,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
C#
XmlDocument xmlDom = new XmlDocument();
xmlDom.Load("D:\CPDCL_01HW342889_ALL_new.xml");

According to me Innerxml data member of XmlDocument can not able to hold this large string data, as its showing innerxml out of memmory exception, when we load the XML.

Since XML file is 135 MB, so we can not attach. So please let me know how to load the large (135 MB).
XML file.

Thanks
Abhi

==============================

The error message was showing as follows,

InnerXml = Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation.
Posted
Updated 13-Dec-11 1:46am
v3
Comments
thatraja 13-Dec-11 5:53am    
/*Since XML file is 135 MB, so we can not attach. So please let me know how to load the large (135 MB).*/
Glad you didn't.

BTW include the complete error message in your question.

Try to convert it to stream and then load in XMLDocument.

FileStream filestream = File.OpenRead(pathtofile); 
XMLDocument objDOM = new XMLDocument();
objDOM.Load(filestream)
 
Share this answer
 
Have you tried loading it using linq to XML using xelement.load ? I believe it's a smaller foot print the xmldocument, although I could be wrong on that.

Derek
 
Share this answer
 
no, we should use xmldocument object only.

-Abhi
 
Share this answer
 
Even AFter using filestream,Iam getting the same problem.
 
Share this answer
 
Try to use this one:


XmlTextReader myTextReader = new XmlTextReader(filename);
myTextReader.WhitespaceHandling = WhitespaceHandling.None;
while (myTextReader.Read())
{
if (myTextReader.NodeType == XmlNodeType.Element &&
myTextReader.LocalName == "Reward" &&
myTextReader.IsStartElement() == true)
{
ProcessRewardNode(myTextReader);
myTextReader.Skip();
}
}



private void ProcessRewardNode(XmlTextReader RewardReader)
{
XmlDocument RewardXmlDoc = new XmlDocument();
RewardXmlDoc.LoadXml(RewardReader.ReadOuterXml());
// we can use xpath as below
myID = RewardXmlDoc.SelectSingleNode("Reward/myID").InnerText;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900