title: Adding subElement at a specific location with xml.dom.minidom (appendChild)
body: <p>I intend to insert a sub element at a specified location. However, I do not know how to do that using <strong>appendChild</strong> in <strong>xml.dom</strong> 
  Here is my xml code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  
  &lt;VOD&gt;
    &lt;root&gt;
   &lt;ab&gt;sdsd
    &lt;pp&gt;pras&lt;/pp&gt;
    &lt;ps&gt;sinha&lt;/ps&gt;
   &lt;/ab&gt;
   &lt;ab&gt;prashu&lt;/ab&gt;
   &lt;ab&gt;sakshi&lt;/ab&gt;
   &lt;cd&gt;dfdf&lt;/cd&gt;
    &lt;/root&gt;
    &lt;root&gt;
   &lt;ab&gt;pratik&lt;/ab&gt;
    &lt;/root&gt;
    &lt;root&gt;
   &lt;ab&gt;Mum&lt;/ab&gt;
    &lt;/root&gt;
  &lt;/VOD&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I would like to insert another sub element "new" in first "root" element just before the "cd" tag. The result should look like this: </p>
  
  <pre><code>&lt;ab&gt;prashu&lt;/ab&gt;
  &lt;ab&gt;sakshi&lt;/ab&gt;
  &lt;new&gt;Anydata&lt;/new&gt;
  &lt;cd&gt;dfdf&lt;/cd&gt;
  </code></pre>
  
  <p>The code I used for this is:</p>
  
  <pre><code>import xml.dom.minidom as m
  
  doc = m.parse("file_notes.xml")
  root=doc.getElementsByTagName("root")
  
  valeurs = doc.getElementsByTagName("root")[0]
  element = doc.createElement("new")
  element.appendChild(doc.createTextNode("Anydata"))
  valeurs.appendChild(element)
  
  doc.writexml(open("newxmlfile.xml","w"))
  </code></pre>
  
  <p>In what way can I achieve my goal?</p>
  
  <p>Thank you in advance..!!</p>