public function delete($x)
{
//echo("in function delete");
$dom = new DomDocument;
$dom->validateOnParse = true; // important, so we get the id listings from the dtd
$dom->load("sampleLink.xml");
$xpath = new DomXPath($dom);
$result = $xpath->query($x);
$linkNode = $result->item(0);
[b]$dom->getElementsByTagName("menu")->item(0)->removeChild($linkNode);[/b]
$dom->save("sampleLink.xml");
}
error occurred at the bold line i do not know why?
the error is
Warning: DOMNode::removeChild() expects parameter 1 to be DOMNode, null given in
public function delete($x)
{
//echo("in function delete");
$dom = new DomDocument;
$dom->validateOnParse = true; // important, so we get the id listings from the dtd
$dom->load("sampleLink.xml");
$xpath = new DomXPath($dom);
$result = $xpath->query($x);
$linkNode = $result->item(0);
[b]$dom->getElementsByTagName("menu")->item(0)->removeChild($linkNode);[/b]
$dom->save("sampleLink.xml");
}