Jump to content

Remove a child node


sajan
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...