title: Add child entry to a specific node in xml file in vbscipt
body: <p>I have an xml file DataConfiguration.xml with this entry</p>
  
  <pre><code>&lt;DataSource&gt;
   &lt;localdata&gt;
      &lt;add context="Localization"&gt;
         &lt;parameter name="timeout" type="int" defaultvalue="60"/&gt;
         &lt;parameter name="address" type="string" defaultvalue="192.168.9.45" /&gt;
         &lt;parameter name="port" type="int" defaultvalue="6789"/&gt;
      &lt;/add&gt;
  &lt;/localdata&gt;
  &lt;/DataSource&gt;
  </code></pre>
  
  <p>I need to add another entry to "localdata" so it would be </p>
  
  <pre><code> &lt;DataSource&gt;
       &lt;localdata&gt;
          &lt;add context="Localization"&gt;
             &lt;parameter name="timeout" type="int" defaultvalue="60"/&gt;
             &lt;parameter name="address" type="string" defaultvalue="192.168.9.45" /&gt;
             &lt;parameter name="port" type="int" defaultvalue="6789"/&gt;
          &lt;/add&gt;
         &lt;add context="General"&gt;
             &lt;parameter name="timeout" type="int" defaultvalue="60"/&gt;
             &lt;parameter name="address" type="string" defaultvalue="192.168.9.478" /&gt;
             &lt;parameter name="port" type="int" defaultvalue="5674"/&gt;
          &lt;/add&gt;
      &lt;/localdata&gt;
      &lt;/DataSource&gt;
  </code></pre>
  
  <p>How would I add this in vbscript? </p>
  
  <p>My Current code</p>
  
  <pre><code>'created xml file object
  Set xmlDoc = CreateObject("Msxml2.DOMDocument")
  
  xmlDoc.async = False  
  xmlDoc.preserveWhiteSpace= True 
  xmlDoc.load("DataConfiguration.xml")
  
  Dim entry
  
  entry = "&lt;add context=""General""&gt;" &amp; _
                 &lt;parameter name=""timeout"" type=""int"" defaultvalue=""60""/&gt;" &amp; _ 
                 &lt;parameter name=""address"" type=""string"" defaultvalue=""192.168.9.478"" /&gt;" &amp; _
                 &lt;parameter name=""port"" type=""int"" defaultvalue=""5674""/&gt;"&amp; _
              &lt;/add&gt;"
  
  Set NewNode = xmlDoc.createElement(entry)
  Set ElemList = xmlDoc.getElementsByTagName("localdata")
  ElemList.appendChild(NewNode)
  </code></pre>
  
  <p>But this give the error </p>
  
  <blockquote>
    <p>This name may not contain &lt; character" at "  Set NewNode = xmlDoc.createElement(entry)</p>
  </blockquote>
  
  <p>Also the ElemList.appendChild(NewNode) does not work.</p>