title: access #text property of XMLAttribute in powershell
body: <p>I have an xml document formated like this:</p>
  
  <pre><code>&lt;root&gt;
  &lt;obj&gt;
     &lt;indexlist&gt;
        &lt;index name="NUMD" value="val1" /&gt;
        &lt;index name="DATE" value="val2" /&gt;
     &lt;/indexlist&gt;
  &lt;/obj&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>now I'd like to change the value attribute of the index element where name is set to "DATE". I get the attribute like this:</p>
  
  <pre><code>$attr = $xml.selectnodes("//obj/indexlist/index[@name='DATE']/@value")
  </code></pre>
  
  <p>I can view the value by typing this:</p>
  
  <pre><code>$attr.'#text'
  </code></pre>
  
  <p>but I can't change it:</p>
  
  <pre><code>$attr.'#text' = 'foo'
  The property '#text' cannot be found on this object. Verify that the property exists and can be set.
  At line:1 char:1
  + $n.'#text' = 'foo'
  + ~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : PropertyAssignmentException
  </code></pre>
  
  <p><strong>how do I change the value of an XMLAttribute?</strong></p>
  
  <hr>
  
  <p>I'd also like to stick with XPath returning the attribute directly if that's possible because the end-user of that script will define the elements and attributes to change in a config file using XPath.<br>
  While using XPath for the attributes as well the user can simply provide the attribute to change and the future-value with just two arguments: the XPath and the value.</p>