title: XMLTextReader is not reading all elements
body: <p>I am trying to read attributes from an XML stream. </p>
  
  <p>Here is an example of the XML code</p>
  
  <pre><code>&lt;string xmlns="http://schemas.microsoft.com/2003/10/Serialization/"&gt;
  &lt;catalog version="1.1"&gt;
  &lt;dataset id="354" name="XXX" description="XXX" datatype="XXX" rank="XXX" saropsrank="XXX4" format="XXX" starttime="XXX" endtime="XXX" extentleft="XXX" extentbottom="XXX" extentright="XXX" extenttop="XXX" source="XXX" wmslayeridstr="XXX" confidence="XXX" directionfrom="XXX" image="XXX" /&gt;
  &lt;dataset id="354" name="XXX" description="XXX" datatype="XXX" rank="XXX" saropsrank="XXX4" format="XXX" starttime="XXX" endtime="XXX" extentleft="XXX" extentbottom="XXX" extentright="XXX" extenttop="XXX" source="XXX" wmslayeridstr="XXX" confidence="XXX" directionfrom="XXX" image="XXX" /&gt;
  &lt;dataset id="354" name="XXX" description="XXX" datatype="XXX" rank="XXX" saropsrank="XXX4" format="XXX" starttime="XXX" endtime="XXX" extentleft="XXX" extentbottom="XXX" extentright="XXX" extenttop="XXX" source="XXX" wmslayeridstr="XXX" confidence="XXX" directionfrom="XXX" image="XXX" /&gt;
  &lt;/catalog&gt;
  &lt;/string&gt;
  </code></pre>
  
  <p>The code I am using to read is as follows:</p>
  
  <pre><code>XmlTextReader readerXML = new XmlTextReader(responseStream);
  
  while (readerXML.Read())
  {
  if (readerXML.HasAttributes)
  {
      Console.WriteLine(readerXML.Name + " Attribute");
      for (int i = 0; i &lt; readerXML.AttributeCount; i++)
      {
          readerXML.MoveToAttribute(i);
          Console.WriteLine("Name: " + readerXML.Name + ", Value: " + readerXML.Value);
      }
  }
  readerXML.MoveToElement();
  }
  </code></pre>
  
  <p>However, it only prints out </p>
  
  <pre><code>string Attribute
  Name: xmlns, Value: http://schemas.microsoft.com/2003/10/Serialization/
  </code></pre>
  
  <p>Any idea why the first element is considered the only "element" in the XML.</p>
  
  <p>Thanks!</p>
  
  <p><strong>EDIT</strong>
  When i covert the stream to a string using the following code:</p>
  
  <pre><code>            WebResponse response = restWebRequest.GetResponse();
              Stream responseStream = response.GetResponseStream();
  
              StreamReader reader = new StreamReader(responseStream);
              string responseFromServer = reader.ReadToEnd();
              textBox1.Text = responseFromServer;
  </code></pre>
  
  <p>I receive this text:</p>
  
  <pre><code>&lt;string xmlns="http://schemas.microsoft.com/2003/10/Serialization/"&gt;
  &amp;lt;catalog version="1.1"&amp;gt;
  &amp;lt;dataset id="354" name="XXX" description="XXX" datatype="XXX" rank="XXX" saropsrank="XXX" format="XXX" starttime="XXX" endtime="XXX" extentleft="-XXX" extentbottom="XXX" extentright="XXX" extenttop="XXX" source="XXX" wmslayeridstr="XXX" confidence="XXX" directionfrom="XXX" image="XXX" /&amp;gt;
  &amp;lt;dataset id="354" name="XXX" description="XXX" datatype="XXX" rank="XXX" saropsrank="XXX" format="XXX" starttime="XXX" endtime="XXX" extentleft="-XXX" extentbottom="XXX" extentright="XXX" extenttop="XXX" source="XXX" wmslayeridstr="XXX" confidence="XXX" directionfrom="XXX" image="XXX" /&amp;gt;
  &amp;lt;dataset id="354" name="XXX" description="XXX" datatype="XXX" rank="XXX" saropsrank="XXX" format="XXX" starttime="XXX" endtime="XXX" extentleft="-XXX" extentbottom="XXX" extentright="XXX" extenttop="XXX" source="XXX" wmslayeridstr="XXX" confidence="XXX" directionfrom="XXX" image="XXX" /&amp;gt;
  &amp;lt;/catalog&amp;gt;
  &lt;/string&gt;
  </code></pre>
  
  <p>Like the xml syntax is being converted to its entity?</p>
  
  <p>Any idea why this is happening/how to fix it?</p>