title: Modifying XML nodes using R
body: <p>I have a input XML file (not HTML) and I want to make changes to the tags. Wherever I find "p" node is child of "step" node, I need to remove it but the content should remain and assigned to "step". Also, the output should be a xml file and I am using R.</p>
  
  <pre><code>&lt;h2&gt;
  &lt;h4&gt;
  &lt;stepgrp type="ordered-legal"&gt;
  &lt;figgrp-inlist&gt;
  &lt;step&gt;
  &lt;graphic version="1" object-id="4188" /&gt;
  &lt;p&gt;Install the clutch spring compressor.&lt;/p&gt;
  &lt;/step&gt;
  &lt;stepgrp2 type="unordered-bullet"&gt;
  &lt;step&gt;
  &lt;p&gt;One piece case  use J414202
  Disc.&lt;/p&gt;
  &lt;/step&gt;
  &lt;step&gt;
  Two piece case  use J42628 Disc.
  &lt;/step&gt;
  &lt;/stepgrp2&gt;
  &lt;/figgrp-inlist&gt;
  &lt;figgrp-inlist&gt;
  &lt;step&gt;
  &lt;graphic version="1" object-id="59269" /&gt;
  &lt;p&gt;Tighten the clutch spring compressor.&lt;/p&gt;
  &lt;/step&gt;
  &lt;step&gt;
  Remove the low/reverse clutch retainer ring.
  &lt;/step&gt;
  &lt;step&gt;
  Remove the low/reverse the clutch spring assembly.
  &lt;/step&gt;
  &lt;/figgrp-inlist&gt;
  &lt;figgrp-inlist&gt;
  &lt;step&gt;
  &lt;graphic version="1" object-id="4190" /&gt;
  &lt;p&gt;Blow compressed air into the case passage to remove the
  low/reverse clutch piston.&lt;/p&gt;
  &lt;/step&gt;
  &lt;/figgrp-inlist&gt;
  &lt;/stepgrp&gt;
  &lt;/h4&gt;
  &lt;/h2&gt;
  </code></pre>
  
  <p>I have written a for loop code where it identifies the line position of "p" and "step" nodes but I want to make it dynamic so that it identifies the "p" node and removes it whenever it is the child of "step" node but the content should remain.
  <br>
  Thank you!</p>