title: How do you create XML nodes using Java DOM?
body: <p>How can I create the below <code>XML</code> using <code>Java DOM</code>, I want to create it from scratch. Is there any way?
  I don't want to read it and clone it, I just want to create it by <code>DOM</code> methods.</p>
  
  <p><code>Java</code> Example:</p>
  
  <pre><code>Node booking=new Node();
  Node bookingID=new Node();
  booking.add(bookingID);
  </code></pre>
  
  <p><code>XML</code> Example:</p>
  
  <pre><code>&lt;tns:booking&gt;
      &lt;tns:bookingID&gt;115&lt;/tns:bookingID&gt;
      &lt;tns:type&gt;double&lt;/tns:type&gt;
      &lt;tns:amount&gt;1&lt;/tns:amount&gt;
      &lt;tns:stayPeriod&gt;
          &lt;tns:checkin&gt;
              &lt;tns:year&gt;2013&lt;/tns:year&gt;
              &lt;tns:month&gt;11&lt;/tns:month&gt;
              &lt;tns:date&gt;14&lt;/tns:date&gt;
          &lt;/tns:checkin&gt;
          &lt;tns:checkout&gt;
              &lt;tns:year&gt;2013&lt;/tns:year&gt;
              &lt;tns:month&gt;11&lt;/tns:month&gt;
              &lt;tns:date&gt;16&lt;/tns:date&gt;
          &lt;/tns:checkout&gt;
      &lt;/tns:stayPeriod&gt;
  &lt;/tns:booking&gt;
  </code></pre>