title: XmlException while parsing xml with encoding specified as "utf-16"
body: <p>I have an issue with parsing XML which has utf-16 encoding but it works perfectly 
  fine with utf-8.<br>
  Can any help me out on this issue?.</p>
  
  <p>I get the following error :  </p>
  
  <blockquote>
    <p><code>System.Web.HttpUnhandledException' was thrown.<br>
    System.Xml.XmlException: There is no Unicode byte order mark.<br>
    Cannot switch to Unicode</code></p>
  </blockquote>
  
  <p>XML Header:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt;
  &lt;RiskAssessmentRequestValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  </code></pre>
  
  <p>C# CODE BEHIND :</p>
  
  <pre><code>    rptTransformedXml.DataSource = parser.ExtractData(xml);
      rptTransformedXml.DataBind();
  
  
      public List&lt;XmlDataExtract&gt; ExtractData(string xml)
      {
          MemoryStream stream = new MemoryStream(Encoding.ASCII.GetBytes(xml));
          return ExtractData(stream);
      }
  
  
      public List&lt;XmlDataExtract&gt; ExtractData(Stream xmlStream)
      {
          XmlReaderSettings settings = new XmlReaderSettings
                                           {
                                               IgnoreComments = true,
                                               IgnoreWhitespace = true,
                                               CloseInput = true
                                           };
  
          XmlReader reader = XmlReader.Create(xmlStream, settings);
          XmlPathBuilder pathBuilder = new XmlPathBuilder(reader);
          List&lt;XmlDataExtract&gt; xmlDataList = new List&lt;XmlDataExtract&gt;();
  
          while (reader.Read())
          {
              if (reader.NodeType == XmlNodeType.XmlDeclaration)
                  continue;
              pathBuilder.Add();
              CollectAttributeData(reader, xmlDataList, pathBuilder);
              CollectElementData(reader, xmlDataList, pathBuilder);
          }
          return xmlDataList;
      }
  </code></pre>