Ck Nitin

Ck Nitin

  • 264
  • 7.1k
  • 3.1m

Parsing string to XElement throwing system.out of.memory

Apr 17 2014 4:24 AM

When I am trying to parse a string value which has a huge text, then I am getting system out of memory exception.

I am using below code.

foreach (KeyValuePair<string, object> item in newXMlValue)
{
      XElement node = (from c in orderXML.Descendants(item.Key) select c).FirstOrDefault();
      if (!object.Equals(node, null))
      {

            XElement xmlValue = XElement.Parse(item.Value.ToString()); // Here I am getting system out of // memory Exception

            node.ReplaceWith(xmlValue);
      }
}

 
Thanks 

Answers (1)