title: Using XMLDocument - How to change an attribute value
body: <p>I am trying to replace a found attribute with a new value, but can not seem to get it....</p>
  
  <p>XML Example</p>
  
  <pre><code>&lt;department sysid="1" name="a" minAmt="0.00" maxAmt="0.00" isAllowFS="0" isNegative="0" isFuel="0" isAllowFQ="0" isAllowSD="0" isBL1="0" isBL2="0" isMoneyOrder="0"&gt;
    &lt;category sysid="0" /&gt;
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>            For Each node In xmldoc.SelectNodes("//department")
                  'For Each node In nodeDepartment
                  Dim a = node.getAttribute("isFuel").ToString
                  If a = 0 Then
                      node.ChildNodes.Item(1).Attributes.getNamedItem("sysid").Value = "400"
                      Dim sName As String = node.getAttribute("name").ToString 'I get the value here
                      If Trim(sName) = "" Then
                          node.Attribute("name") = "A" 'I Error on this line 
                      End If
                  End If
                  lCount += 1
              Next
  </code></pre>