title: XmlReader and NodeTypes
body: <p>I have an XML file I need to read from to get some text values. I am having trouble with the reader.NodeType = XMLNodeType.Text and understanding what constitutes a node to be of NodeType.Text.</p>
  
  <p>My XML reader is only picking up NodeType = Element and ignoring any text in between the node declarations.</p>
  
  <p>Sample XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;myxmlfile&gt;
    &lt;ActivitiesHelp&gt;
    &lt;helptext&gt;Some text goes here I need to read.&lt;/helptext&gt;
    &lt;/ActivitiesHelp&gt;
  &lt;/myxmlfile&gt;
  </code></pre>
  
  <p>And my code looks like this:</p>
  
  <pre><code>elementName = formName.Replace(" ", "");
  while (reader.Read())
  {
      // when we find an element node, we remember its name  
      if ((reader.NodeType == XmlNodeType.Element) &amp;&amp; (reader.Name == elementName))
      {
          reader.Read();
          //if the next node = 'helptext' then get that text data
          if (reader.Name == "helptext")
          {
              // for text nodes...get the text values
              if ((reader.NodeType == XmlNodeType.Text) &amp;&amp; (reader.HasValue))
              {
                  formMessage = reader.Value;
              }
          }
      }
  }      
  </code></pre>
  
  <p>The if statement for <code>Nodetype == XmlNodeType.Text</code> never hits true.</p>
  
  <p>What am I doing wrong, and how do you specify a nodetype of Text in XML file?</p>