PHP Classes

Usefull Tips

Recommend this page to a friend!

      XmlNode  >  All threads  >  Usefull Tips  >  (Un) Subscribe thread alerts  
Subject:Usefull Tips
Summary:Put here usefull tips
Messages:1
Author:Julio Cezar Novais Raffaine
Date:2007-06-21 15:49:42
 

  1. Usefull Tips   Reply   Report abuse  
Picture of Julio Cezar Novais Raffaine Julio Cezar Novais Raffaine - 2007-06-21 15:49:42
First Tip:
- How to delete nodes.
First, you need to change function toXML().
Add a verification in the second foreach. like:
if(child != NULL) {
bla bla bla
child->toXML(niveau+1);
}
This is important, cause if you don't do this, you are going to receive error messages.
After this, just get the node you want to delete, and do something like this:
$node =& $root->findFirstChild($name);
$node = NULL;
$xml = $root->toXML(0);
After this just write $xml in a file, and it's done, you don't have that node anymore. Simple isn't it.

That's all Folks.