Jump to content

Remove a child node


sajan

Recommended Posts

How remove a child node from xml file? When i try to remove i got error message.Warning: DOMNode::removeChild() expects parameter 1 to be DOMNode, string given'code

 $xmlDoc = new DOMDocument();$xmlDoc->load($file);  $x = $xmlDoc->documentElement;$rootT=$x->tagName;//$result is an array for($i=0;$i<sizeof($result);$i++) { $root = $xmlDoc->getElementsByTagName($rootT)->item(0); $root->removeChild($result[$i]);						 }$xmlDoc->save($file);

What may be the problem?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...