title: Porting XmlTextReader to XmlReader with same behaviour
body: <p>I want to port some C# code with the full .NET Framework as target into Silverlight-compatible code.</p>
  
  <p>One of the problems I've encountered is that in the original code, an instance of <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmltextreader.aspx" rel="nofollow"><code>XmlTextReader</code></a> is used:</p>
  
  <pre><code>var xmlReader = new XmlTextReader(streamReader) {
      WhitespaceHandling = WhitespaceHandling.None,
      xmlResolver = null
  };
  </code></pre>
  
  <p>However, in Silverlight, only <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlreader%28v=VS.95%29.aspx" rel="nofollow"><code>XmlReader</code></a> is available. Therefore, I'm wondering how to convert from the original <code>XmlTextReader</code>.</p>
  
  <p>In the documentation of <code>XmlTextReader</code>, it's stated that </p>
  
  <blockquote>
    <p>In the .NET Framework version 2.0 release, the recommended practice is to create XmlReader instances using the XmlReader.Create method. This allows you to take full advantage of the new features introduced in this release. For more information, see Creating XML Readers.</p>
  </blockquote>
  
  <p>This supports the theory that a port should be possible.</p>
  
  <p>How does the initialization of a <code>XmlReader</code> has to look like to process the XML files <em>exactly</em> the same as the <code>XmlTextReader</code> instance mentioned above?</p>
  
  <pre><code>var settings = new XmlReaderSettings {
      ...
  }
  var xmlReader = XmlReader.Create(streamReader, settings);
  </code></pre>