I have a 80MB XML file that has no carriage returns. I would like to find the count of an element within the document. The following code:
StreamReader
reader = File.OpenText(file.xml);
string contents = reader.ReadToEnd();
MatchCollection matches1 = Regex.Matches(contents, "<element>");
count1 = matches1.Count;
produces an out of memory exception error for contents string .
Any suggestions?