title: Inserting a node in an xml file
body: <p>I would like to insert a node in an xml file using Java DOM. I am actually editing a lot of contents of a dummy file in order to mofidy it like the original. </p>
  
  <p>I would want to add an open node and close node in between the following file;</p>
  
  <pre><code>            &lt;?xml version="1.0" encoding="utf-8"?&gt;
              &lt;Memory xmlns:xyz="http://www.w3.org/2001/XMLSchema-instance"   
              xmlns:abc="http://www.w3.org/2001/XMLSchema" Derivative="ABC"            
              xmlns="http://.."&gt;
  
         ///////////&lt;Address&gt; ///////////(which I would like to insert)
  
              &lt;Block ---------
              --------
              -------
              /&gt;
  
        ////////// &lt;/Address&gt; /////////(which I would like to insert)
  
              &lt;Parameters Thread ="yyyy" /&gt;
              &lt;/Memory&gt;
  </code></pre>
  
  <p>I hereby request you to let me know how to I insert  --  in between the xml file?</p>
  
  <p>Thanks in advance.!  </p>
  
  <p>What I have tried doing is;</p>
  
  <pre><code>            Element child = doc.createElement("Address");
      child.appendChild(doc.createTextNode("Block"));
      root.appendChild(child);
  </code></pre>
  
  <p>But this gives me an output like;</p>
  
  <pre><code>        &lt;Address&gt; Block &lt;/Address&gt; and not the way i expect :(
  </code></pre>
  
  <p>And now, what I have tried is to add these lines;</p>
  
  <pre><code>            Element cd = doc.createElement("Address");
              Node Block = root.getFirstChild().getNextSibling();
          cd.appendChild(Block);
          root.insertBefore(cd, root.getFirstChild());
  </code></pre>
  
  <p>But still, this is not the output which i am looking for. I got this output as 
                 ---------</p>