title: reading xml file with vbscript
body: <p>I am trying to write a vbscript to automate the configuration of a storage array. I'm having some difficulty figuring out how best to navigate the XML.</p>
  
  <p>An example section of my XML:</p>
  
  <pre><code>&lt;SERVER&gt;
  &lt;INTERFACE&gt;
  &lt;PORT&gt;0&lt;/PORT&gt;
  &lt;IPADDRESS&gt;192.168.1.1&lt;/IPADDRESS&gt;
  &lt;NETMASK&gt;255.255.255.0&lt;/NETMASK&gt;
  &lt;/INTERFACE&gt;
  &lt;INTERFACE&gt;
  &lt;PORT&gt;1&lt;/PORT&gt;
  &lt;IPADDRESS&gt;192.168.1.2&lt;/IPADDRESS&gt;
  &lt;NETMASK&gt;255.255.255.0&lt;/NETMASK&gt;
  &lt;/INTERFACE&gt;
  &lt;/SERVER&gt;
  </code></pre>
  
  <p>So I want to iterate through each interface (there is 5 in reality) and set the appropriate IP and netmask on the correct interface.</p>
  
  <p>I'm currently doing this:</p>
  
  <pre><code>Set objXMLDoc = CreateObject("Microsoft.XMLDOM") 
  objXMLDoc.async = False 
  objXMLDoc.load("example.xml")
  
  Set Root = objXMLDoc.documentElement 
  Set NodeList = Root.getElementsByTagName("interface") 
  port = 0
  For Each Elem In NodeList 
  WScript.Echo "Port " &amp; port &amp; " has IP address of " &amp; Elem.text
  port = port + 1
  Next
  </code></pre>
  
  <p>but there must be a cleaner way do doing this where I can select the interface section and read in the port, ipaddress &amp; netmask, issue the command and then move into the next interface?</p>
  
  <p>Thanks.</p>