hi every one. My xml file is named cgal.xml
<?xml version="1.0"?>
<item>
<name><![CDATA[<img src="event_pic/pic1.jpg" />CALENDAR]]></name>
<description title="NAM ELIT AGNA, ENDRERIT SIT AMET, TINCIDUNT AC." day="13" month="8" year="2010" id="15"><![CDATA[<img src="events/preview/13p1.jpg" /><font size="8" color="#6c6e74">In Gladiator, victorious general Maximus Decimus Meridias has been named keeper of Rome and its empire by dying emperor Marcus Aurelius, so that rule might pass from the Caesars back to the people and Senate. Marcus\' neglected and power-hungry son, Commodus, has other ideas, however. Escaping an ordered execution, Maximus hurries back to his home in Spain, too l</font>]]></description>
</item>
and my PHP function is:-
$doc = new DOMDocument;
$doc->formatOutput = TRUE;
$doc->preserveWhiteSpace = FALSE;
$doc->simplexml_load_file('../cgal.xml');
foreach($doc->description as $des)
{
if($des['id'] == $id) {
$dom=dom_import_simplexml($des);
$dom->parentNode->removeChild($dom);
}
}
$doc->save('../cgal.xml');
id is passed dynamically
I want to remove node according to id