as i had announced a while ago on pear-dev that i have a tree class 
which works on DB-data, now it is more enhanced and also works on XML 
(for now it can only read but within a week or something it will also 
be able to write)

short description:
---------------------
this class reads data from either a db or xml file saves them in an 
internal (array) structure (sounds kinda like DOM, doesnt it? i dont 
know if it is alike, havent checked the PHP-DOM yet) and you can work 
on those data
you can read navigate through the tree from ever point to any other 
since every element has references to all its "neighbours" i.e.
   $treeData [$id] ['parent'] ['next'] ['next'] ['child']
takes you to the parent's 2nd next element's child ... well just look 
at the example page where you can try it
for navigation one can use ['next'], ['previous'], ['parent'], 
['child'], ['children']  i think that's it
every element has an unique identifier, it's id, by which you can 
refer to it and get information or data or apply functions to it i.e.

   $tree->getPath( $id )

   // very useful for navigating inside XML-structures
   $id = $tree->getIdByPath( 'XMLNode / SubNode / SubSubNode' )

   // or do it relative starting at $id
   $tree->getIdByPath( 'SubNode3/SubNode4' , $id );

   $tree->hasChildren( $id )
   $tree->getChildren( $id )
   .... and many more

to manipulate the structure you can use methods like
'add', 'remove', 'move'   ... 'update' and 'copy' are not done yet
or even 'addNode' which can add an entire tree under a given element

i think that's mainly what it can do
it makes some stuff much easier, now tree structures are no problem 
anymore for me, as it used to be a couple months ago
AND i can read XML(-config) files and simply retreive their data 
without much action, see SimpleTemplate class for examples, it uses 
XML-files/data to configure the settings for each template if wanted

please note,
that actually the class was meant to work on a DB-tree structure, 
that's why its not optimized all the way for XML, but it works

extending the class to access nested-db-tables should be no problem 
either

all those files can be found at 
http://wolfram.kriesing.de/programming

might be useful in PEAR, i guess

-- 
Wolfram

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to