title: Removing an xml node using php
body: <p>I have an xml file like this:</p>
  
  <pre><code>&lt;uploads&gt;
   &lt;upload&gt;
    &lt;name&gt;asd&lt;/name&gt;
    &lt;type&gt;123&lt;/name&gt;
   &lt;/upload&gt;
   &lt;upload&gt;
    &lt;name&gt;qwe&lt;/name&gt;
    &lt;type&gt;456&lt;/name&gt;
   &lt;/upload&gt;
  &lt;/uploads&gt;
  </code></pre>
  
  <p>Now I want to delete a node upload that has a name child as (say <strong>qwe</strong>). How can I delete it using php , so that the resulting xml is </p>
  
  <pre><code>&lt;uploads&gt;
   &lt;upload&gt;
    &lt;name&gt;asd&lt;/name&gt;
    &lt;type&gt;123&lt;/name&gt;
   &lt;/upload&gt;
  &lt;/uploads&gt;
  </code></pre>
  
  <p>I do not have too much knowledge about xml and related techniques. Is it possible to do it using xpath, like this <code>$xml-&gt;xpath('//upload//name')</code>? Assuming <code>$xml</code> was loaded using <code>simplexml_load_file()</code> function. </p>
  
  <p>For reference, I was using <a href="https://stackoverflow.com/questions/262351/remove-a-child-with-a-specific-attribute-in-simplexml-for-php">this question</a> to do what I want. But, it selects the element based on an attribute and I want to select an element based on the value of it child node.</p>