blob: 50a17f3525f8fb23e66a1cf09307b2ad163f6994 [file] [log] [blame]
<?php
require_once 'tutorial_autoload.php';
$store = new ezcTreeXmlInternalDataStore();
$tree = new ezcTreeXml( 'files/example1.xml', $store );
if ( $tree->fetchNodeById( 'F' )
->isDescendantOf( $tree->fetchNodeById( 'NonMetals' ) ) )
{
echo "Flourine is a non-metal.<br/>\n";
}
if ( $tree->isDescendantOf( 'O', 'NonMetals' ) )
{
echo "Oxygen is a non-metal.<br/>\n";
}
$nonMetals = $tree->fetchSubtree( 'NonMetals' );
echo "We found {$nonMetals->size} non-metals: \n";
foreach ( $nonMetals->nodes as $node )
{
echo "- {$node->id}: {$node->data} \n";
}
?>