voglio eliminare il nodo che ha src=4_5.jpg

codice:
$doc = new DOMDocument; $doc->load('articles.xml');


$thedocument = $doc->documentElement;


$list = $thedocument->getElementsByTagName('article');

$nodeToRemove = null;
foreach ($list as $domElement){
  $attrValue = $domElement->getElementsByTagName('src');
  if ($attrValue->item(0) == '4_5.jpg') {
    $nodeToRemove = $domElement; //will only remember last one- but this is just an example :)
  }
}


if ($nodeToRemove != null)
$thedocument->removeChild($nodeToRemove);


echo $doc->saveXML();

articles.xml
codice:
<?xml version="1.0" encoding="utf-8"?><articles>
  <article>
    <url>http://www.abc.cin</url>
    <src>4_4.jpg</src>
  </article>
  <article>
    <url>http://www.abc.cin</url>
    <src>4_5.jpg</src>
  </article>
</articles>
probabilmente la parte sbagliata è
codice:
 $attrValue = $domElement->getElementsByTagName('src');
  if ($attrValue->item(0) == '4_5.jpg') {..