title: XmlTextReader passes end of XML document without recognizing
body: <p>I'm trying to create a simple App which reads a XML using SAX (XmlTextReader) from a stream which does not only contain the XML but also other data such as binary blobs and text. The structure of the stream is simply chunk based.</p>
  
  <p>When entering my reading function, the stream is properly positioned at the beginning of the XML. I've reduced the issue to the following code example:</p>
  
  <pre><code>string xml = "&lt;?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?&gt;&lt;Models /&gt;" + (char)0x014;
  
  XmlTextReader reader = new XmlTextReader(new StringReader(xml));
  reader.MoveToContent();
  reader.ReadStartElement("Models");
  </code></pre>
  
  <p>These few lines causes an exception when calling ReadStartElement due to the 0x014 at the end of the string.</p>
  
  <p>The interesting thing about it is, that the code runs just fine when using the following input instead:</p>
  
  <pre><code>string xml = "&lt;?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?&gt;&lt;Models&gt;&lt;/Models&gt;" + (char)0x014;
  </code></pre>
  
  <p>I don't want to read the whole document due to its size nor do I want to change the input as I need to stay backward compatible to older data inputs.</p>
  
  <p>The only solution I can think of at first is a custom stream reader which doesn't continue to read after the last ending tag but that would involve some major parsing efforts.</p>
  
  <p>Do you have any ideas on how to solve this issue? I've already tried to use LINQ's XDocument but that also failed.</p>
  
  <p>Thank you very much in advance,
  Cheers,</p>
  
  <p>Romout</p>