title: Reading XML File ( File size > 500 MB)
body: <p>I'm trying to parse large XML file (size near about 600MB) and using </p>
  
  <p>It's taking longer time and finally, the entire process is aborted. The process is ending with an exception.</p>
  
  <p>Message: <strong>"Thread is aborted"</strong></p>
  
  <p>Method:</p>
  
  <pre><code>private string ReadXml(XmlTextReader reader, string fileName)
  {
      string finalXML = "";
      string s1 = "";
      try
      {
          while (reader.Read())
          {
              switch (reader.NodeType)
              {
                  case XmlNodeType.Element: // The node is an element.
                      s1 += "&lt;" + reader.Name + "&gt;";
                      break;
                  case XmlNodeType.Text: //Display the text in each element.
                      s1 += reader.Value;
                      break;
                  case XmlNodeType.EndElement: //Display the end of the element.
                      s1 += "&lt;/" + reader.Name + "&gt;";
                      break;
              }
              finalXML = s1;
          }
      }
      catch (Exception ex)
      {
         Logger.Logger.LogMessage(ex, "File Processing error: " + fileName);
      }
      reader.Close();
      reader.Dispose();
  
      return finalXML;
  }
  </code></pre>
  
  <p>And then reading and desalinizing:</p>
  
  <pre><code>string finalXML = string.Empty;
  XmlTextReader reader = new XmlTextReader(unzipfile);
  finalXML = await ReadXml(reader, fileName);
  
  var xmlremovenamespae = Helper.RemoveAllNamespaces(finalXML);
  XmlParseObjectNew.BizData myxml = new XmlParseObjectNew.BizData();
  
  using (StringReader sr = new StringReader(xmlremovenamespae))
   {
         XmlSerializer serializer = new XmlSerializer(typeof(XmlParseObjectNew.BizData));
         myxml = (XmlParseObjectNew.BizData)serializer.Deserialize(sr);
   }
  </code></pre>
  
  <p>Is there any better way to read &amp; parse large xml file? need a suggestion. </p>