Re: Re: cvs: pear /XML_Tree XML_Tree.php package.xml
| From: | Tomas V.V.Cox | Date: | Sun, 19 Aug 2001 17:30:23 +0000 |
| Subject: | Re: Re: cvs: pear /XML_Tree XML_Tree.php package.xml | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1611@lists.php.net to get a copy of this message | ||
Sebastian Bergmann wrote:
>
> I had a quick look at your class. XML_Tree current has no
> method to load an existing XML file and map it into a tree of
> XML_Tree_Node objects.
>
> So, why not add your mapping algorithm to the new class, and then
> remove it?
>
Sebastian,
I've added it to your class (see the log), works fine for me, drop me a
note if find any problem. For getting the tree from a xml file do (see
also the small test.php I've commited):
$tree = new XML_Tree('../package.xml');
$root = $tree->getTreeFromFile();
print_r($root);
$root->dump();
Also I did some minor changes to Node.php (sorry for the way I moved it
to Tree/Node.php):
- added method set_content()
- added method dump()
- don't strtolower the node name in constructor
Some suggestions for the class:
- add a auto-trim contents option.
- add a method to pass options to the Parser (folding, charset encoding,
etc).
- add the ability to build the tree from a string.
Regards,
Tomas V.V.Cox