Run the following piece of code, and then inspect the output XML. You will additionnally get the exception reported below the code snippet.
$store = new ezcTreeXmlInternalDataStore();
// $tree = ezcTreeMemoryXml::create( '', $store );
$tree = ezcTreeXml::create( '/tmp/test.xml', $store );
$tree->autoId = true;
$rootNode = $tree->createNode( null, 'Elements' );
$tree->setRootNode( $rootNode );
$nonMetal = $tree->createNode( 'NonMetals', 'Non-Metals' );
$rootNode->addChild( $nonMetal );
$nobleGasses = $tree->createNode( null, 'Noble Gasses' );
$rootNode->addChild( $nobleGasses );
$nonMetal->addChild( $tree->createNode( null, 'Hydrogen' ) );
$nonMetal->addChild( $tree->createNode( null, 'Carbon' ) );
$tree->saveFile();
echo '<pre>';
echo file_get_contents( '/tmp/test.xml' );
echo '</pre>';
echo '<hr />';
$NonMetals = $tree->fetchNodeById( 'NonMetals' );
$NonMetals->dataFetched = true;
$NonMetals->data = "Non-Metals renamed";
$tree->saveFile();
$NonMetals = $tree->fetchNodeById( 'NonMetals' );
echo '<pre>';
echo file_get_contents( '/tmp/test.xml' );
echo '</pre>';
$tree = new ezcTreeXml( '/tmp/test.xml', $store );
ezcTreeInvalidXmlFormatException: The XML file '/tmp/test.xml' does not validate according to the expected schema: /private/tmp/test.xml:12:0: Did not expect element data there in /usr/local/apache_php4/htdocs/ezc_trunk/Tree/src/backends/xml.php on line 145