title: Parsing XML String in VBScript
body: <p>I have a web service which returns XML string similar to the one below:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0"?&gt;
  &lt;Result&gt;
      &lt;PersonID&gt;991166187&lt;/PersonID&gt;
      &lt;AddressID&gt;1303836&lt;/AddressID&gt;
  &lt;/Result&gt;
  </code></pre>
  
  <p>I need a VBScript code that will allow me to retrieve the values for <code>PersonID</code> and <code>AddressID</code>. My specific question is <strong>how can I retrieve value for <code>PersonID</code></strong>, i.e. <code>991166187</code>, from the XML string in my original post.</p>
  
  <p>In terms of what I have tried, I have the following code:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim doc
  Dim xmlString
  Dim nodes
  Dim idArray
  
  xmlString = "&lt;?xml version="1.0"?&gt;&lt;Result&gt;&lt;PersonID&gt;991166187&lt;/PersonID&gt;&lt;AddressID&gt;1303836&lt;/Address&amp;#8204;&amp;#8203;ID&gt;&lt;/Result&gt;"
  
  Set doc = CreateObject("MSXML2.DOMDocument")
  doc.loadXML(xmlString)
  
  'Set nodes = doc.selectNodes("Result/PersonID/AddressID")
  nodes = doc.getElementsByTagName("PersonID")
  
  For Each node In nodes
    WScript.Echo "Person ID: " &amp; node.text
  </code></pre>