title: adding xml innertext with foreach loop
body: <p>I am trying to add values to the saml:AttributeValue elements of this xml document:</p>
  
  <pre><code>&lt;saml:AttributeStatement  xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"&gt;
  &lt;saml:Attribute Name="FNAME"&gt;
    &lt;saml:AttributeValue&gt;&lt;/saml:AttributeValue&gt;
  &lt;/saml:Attribute&gt;
  &lt;saml:Attribute Name="LNAME"&gt;
    &lt;saml:AttributeValue&gt;&lt;/saml:AttributeValue&gt;
  &lt;/saml:Attribute&gt;
  &lt;saml:Attribute Name="Gender"&gt;
    &lt;saml:AttributeValue&gt;&lt;/saml:AttributeValue&gt;
  &lt;/saml:Attribute&gt;
  &lt;saml:Attribute Name="UniqueID"&gt;
    &lt;saml:AttributeValue&gt;&lt;/saml:AttributeValue&gt;
  &lt;/saml:Attribute&gt;
  &lt;saml:Attribute Name="DateOfBirth"&gt;
    &lt;saml:AttributeValue&gt;&lt;/saml:AttributeValue&gt;
  &lt;/saml:Attribute&gt;
  &lt;saml:Attribute Name="ClientID"&gt;
    &lt;saml:AttributeValue&gt;&lt;/saml:AttributeValue&gt;
  &lt;/saml:Attribute&gt;
  </code></pre>
  
  <p></p>
  
  <p>Using this c# code:</p>
  
  <pre><code>//get the AttributeStatement node
      XmlNode attrs = assertion.SelectSingleNode("//saml:AttributeStatement", ns1);
  //get the Attribute nodes within the AttributeStatement node
              XmlNodeList attr = attrs.SelectNodes("//saml:Attribute", ns1);
  
  //foreach node in the Attribute node list get the AttributeValue node and add an innerText value
              foreach (XmlNode xn in attr)
              {
                  XmlNode attrValue = xn.SelectSingleNode("//saml:AttributeValue", ns1);
                  switch (xn.Attributes["Name"].Value)
                  {
                      case "FNAME":
                          attrValue.InnerText = UserInfo.FirstName;
                          break;
                      case "LNAME":
                          attrValue.InnerText = UserInfo.LastName;
                          break;
                      case "Gender":
                          attrValue.InnerText = UserInfo.Email;
                          break;
                      case "UniqueID":
                          attrValue.InnerText = UserInfo.UserID.ToString();
                          break;
                      case "DateOfBirth":
                          attrValue.InnerText = UserInfo.UserID.ToString();
                          break;
                      case "ClientID":
                          attrValue.InnerText = UserInfo.UserID.ToString();
                          break;
                      default:
                          attrValue.InnerText = "No attribute listed";
                          break;
                  }
  //output each AttributeValue innerText.
                  lblTest.Text += attrValue.InnerText + " ";
  
              }
  </code></pre>
  
  <p>The lblTest is displaying how I would expect - with the correct values for all 6 elements, but the document is not displaying any values at all. Is this the correct way to loop through and add these values to nodes?</p>