code: public function deleteSelf()
      {
          $tmp = dom_import_simplexml($this);
  
          if ($tmp->isSameNode($tmp->ownerDocument->documentElement)) {
              throw new BadMethodCallException('deleteSelf() cannot be used to delete the root node');
          }
  
          $tmp->parentNode->removeChild($tmp);
      }
docs: Delete this node from document
  
  This is a convenience method. The same result can be achieved with
  <code>
  $node->parentNode()->removeChild($node);
  </code>
  
  @throws BadMethodCallException
  @return    void