title: Ruby/REXML: Change a tag value from XPath
body: <p>I have a base XML that I need to modify through a Ruby script. The XML looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;config&gt;
          &lt;name&gt;So and So&lt;/name&gt;
      &lt;/config&gt;
  </code></pre>
  
  <p>I am able to print the value of <code>&lt;name&gt;</code>:</p>
  
  <pre><code>require 'rexml/document'
  include REXML
  
  xmlfile = File.new("some.xml")
  xmldoc = Document.new(xmlfile)
  
  name = XPath.first(xmldoc, "/config/name")
  p name.text # =&gt; So and so
  </code></pre>
  
  <p>What I would like to do is to <em>change</em> the value ("So and so") by something else. I can't seem to find any example (in the documentation or otherwise) for that use case. Is it even possible to do in Ruby 1.9.3?</p>