title: Java JDOM XML: How move node one level up
body: <p>I have the following problem. I want to move a nodes and all their children one level up, example:</p>
  
  <p>Original XML file:</p>
  
  <pre><code>&lt;a&gt;
    &lt;r&gt;
      &lt;b&gt;test&lt;/b&gt;
      &lt;c&gt;
        &lt;d&gt;test&lt;/d&gt;
        &lt;e&gt;test&lt;/e&gt;
        &lt;f&gt;
          &lt;k&gt;ddd&lt;/k&gt;
        &lt;/f&gt;
      &lt;/c&gt;
    &lt;/r&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>So I want to get the tag <code>&lt;r&gt;</code> and all its sub-elements and move them one level up:</p>
  
  <pre><code>&lt;r&gt;
    &lt;b&gt;test&lt;/b&gt;
    &lt;c&gt;
      &lt;d&gt;test&lt;/d&gt;
      &lt;e&gt;test&lt;/e&gt;
      &lt;f&gt;
        &lt;k&gt;ddd&lt;/k&gt;
      &lt;/f&gt;
    &lt;/c&gt;
  &lt;/r&gt;
  </code></pre>
  
  <p>I did not find any function for that in JDOM2.</p>