title: Replace XML attribute value
body: <p>I've been reading about working with XML files for the past couple days and am pulling my hair out.  </p>
  
  <p>It seems like it would be simple to get an attribute and change the value but I can't make it happen.</p>
  
  <p>I have the following XML file called input.xml:</p>
  
  <pre><code>&lt;gs:GlobalizationService xmlns:gs="urn:longhornGlobalizationUnattend"&gt;
      &lt;gs:UserList&gt;
          &lt;gs:User UserID="Current"/&gt;
      &lt;/gs:UserList&gt;
      &lt;gs:InputPreferences&gt;
          &lt;gs:InputLanguageID Action="add" ID="0409:00000409" Default="true"/&gt;
      &lt;/gs:InputPreferences&gt;
  &lt;/gs:GlobalizationServices&gt;
  </code></pre>
  
  <p>I need to be able to change the value of the attribute ID.  It seems as though I should be able to use a combination of the selectSingleNode and setAttribute commands to accomplish this but I can't get it to work.</p>
  
  <p>A snippet of what I have been trying follows.  Value is defined elsewhere in the main script based on a user selection.</p>
  
  <pre><code>Dim xmlDoc, xmlNode
  Set xmlDoc = CreateObject("Microsoft.XMLDOM")
  xmlDoc.Async = "False"
  xmldoc.Load("input.xml")
  
  Set xmlNode = xmlDoc.selectSingleNode("gs:GlobalizationServices/gs:InputPreferences/gs:InputLanguageID")
  xmlNode.setAttribute "ID", Value
  xmlDoc.save("input.xml")
  </code></pre>