Help with XML_Tree
| From: | Chris Boget | Date: | Sat, 16 Sep 2006 20:34:14 +0000 |
| Subject: | Help with XML_Tree | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-25149@lists.php.net to get a copy of this message | ||
Does anyone know of any tutorials anywhere on the web? Or could someone give me a sample how to use this class? I've been spending the last several hours trying to figure this out but am having nothing but problems. Here is my code:
$XMLStr = '<Items><Item><ItemName>blah</ItenName></Item><Item><ItemName>blah</ItenName></Item></Items>'
$xmlTree =& new XML_Tree();
$xmlRoot = $xmlTree->addRoot( 'AllItemsRoot' );
$xmlNode = $xmlTree->getTreeFromString( $XMLStr );
$xmlRoot->insertChild( 'AllItemsRoot/', 0, $xmlNode );
$xmlTree->dump();
One of the following occurs depending on how I fool about with my code to try to get it to work:
* I get an error when I try to insert the child
* Only the root node prints out (ie, <AllItemsRoot></AllItemsRoot>) and nothing else
* Only the part of the structure that begins with <Items> prints out.
I'm trying to build a larger XML document by piecing together smaller XML documents. Just that nothing I've tried works.
Any help would be greatly appreciated!
thnx,
Christoph