title: Sort nodes in XML using DOM parser
body: <p>How can I sort the XML nodes according to the  tag and append in 
   the new XML using DOM parser or can it be done using DOM parser. We've 
   used DOM parser extensively for appending nodes into a new file but I am   not able to sort the nodes.</p>
  
  <p>Any help would be highly appreciated.</p>
  
  <p>Input.xml</p>
  
  <pre><code>&lt;rss version="2.0"&gt;
      &lt;Configs&gt;
          &lt;Value&gt;defaultValue&lt;/Value&gt;
          &lt;Config name="test1"&gt;
              &lt;title&gt;Title 1&lt;/title&gt;
              &lt;author&gt;Author1&lt;/author&gt;
              &lt;value&gt;5600&lt;/value&gt;
              &lt;order&gt;02&lt;/order&gt;
          &lt;/Config&gt;
          &lt;Config name="test2"&gt;
              &lt;title&gt;Title 2&lt;/title&gt;
              &lt;author&gt;Author2&lt;/author&gt;
              &lt;Value&gt;6100&lt;/Value&gt;
              &lt;order&gt;01&lt;/order&gt;
          &lt;/Config&gt;
      &lt;/Configs&gt;
      &lt;Ratings&gt;
          &lt;body&gt;
              &lt;Items name="ac_object1"&gt;
                  &lt;something1&gt;something1&lt;/something1&gt;
                  &lt;value&gt;someValue1&lt;/value&gt;
                  &lt;order&gt;02&lt;/order&gt;
              &lt;/Items&gt;
              &lt;Items name="op_object2"&gt;
                  &lt;something1&gt;something2&lt;/something1&gt;
                  &lt;value&gt;someValue2&lt;/value&gt;
                  &lt;order&gt;03&lt;/order&gt;
              &lt;/Items&gt;
              &lt;Items name="vt_object3"&gt;
                  &lt;something1&gt;something3&lt;/something1&gt;
                  &lt;value&gt;someValue3&lt;/value&gt;
                  &lt;order&gt;01&lt;/order&gt;
              &lt;/Items&gt;
          &lt;/body&gt;
      &lt;/Ratings&gt;
  &lt;/rss&gt;
  </code></pre>
  
  <p>Expected Output.xml</p>
  
  <pre><code>&lt;rss version="2.0"&gt;
      &lt;Configs&gt;
          &lt;Value&gt;defaultValue&lt;/Value&gt;
          &lt;Config name="test2"&gt;
              &lt;title&gt;Title 2&lt;/title&gt;
              &lt;author&gt;Author2&lt;/author&gt;
              &lt;Value&gt;6100&lt;/Value&gt;
              &lt;order&gt;01&lt;/order&gt;
          &lt;/Config&gt;
          &lt;Config name="test1"&gt;
              &lt;title&gt;Title 1&lt;/title&gt;
              &lt;author&gt;Author1&lt;/author&gt;
              &lt;value&gt;5600&lt;/value&gt;
              &lt;order&gt;02&lt;/order&gt;
          &lt;/Config&gt;
      &lt;/Configs&gt;
      &lt;Ratings&gt;
          &lt;body&gt;
              &lt;Items name="vt_object3"&gt;
                  &lt;something1&gt;something3&lt;/something1&gt;
                  &lt;value&gt;someValue3&lt;/value&gt;
                  &lt;order&gt;01&lt;/order&gt;
              &lt;/Items&gt;
              &lt;Items name="ac_object1"&gt;
                  &lt;something1&gt;something1&lt;/something1&gt;
                  &lt;value&gt;someValue1&lt;/value&gt;
                  &lt;order&gt;02&lt;/order&gt;
              &lt;/Items&gt;
              &lt;Items name="op_object2"&gt;
                  &lt;something1&gt;something2&lt;/something1&gt;
                  &lt;value&gt;someValue2&lt;/value&gt;
                  &lt;order&gt;03&lt;/order&gt;
              &lt;/Items&gt;
          &lt;/body&gt;
      &lt;/Ratings&gt;
  &lt;/rss&gt;
  </code></pre>