wddx class mapping and pretty print

From: Date: Wed, 23 Apr 2003 12:47:07 +0000
Subject: wddx class mapping and pretty print
Groups: php.internals 
Request: Send a blank email to internals+get-1015@lists.php.net to get a copy of this message
On one of those - xml is too difficult stints, I started thinking about using wddx as a generic storage system - perhaps thinking about things like MDB's data structure and the ability to load data.. I'm still thinking that it would be nice for wddx_deserialize to accept a stream - hence allowing the processing of huge xml files with minimal memory penalty.. This patch does 2 things. a) a deserialize class mapping - so you can map stored classes into different instantation classes. (usefull when you dont have the original - or just want to map it to something else. - eg use the data with an extended class. class tests_wddxtest { var $somearray = array(1,2,3); var $someassoc = array('dog'=>'cat','mouse'=>'cat'); var $child; function test() { foreach($this->somearray as $i) { $this->child[] = new tests_wddxtest; } } } $x = new tests_wddxtest; $x->test(); class silly { function __wakeup() { // echo "Construct silly"; print_r($this); $this = null; } } $xx = wddx_serialize_value($x, "Testing X"); wddx_map_class(array('gtk_classviewer_tests_wddxtest'=> 'silly')); $yy = wddx_deserialize($xx); var_dump($yy); in this example the wakup call can be used to commit to a database and free the memory :) - useful... b) pretty printing of the xml so that it could be hand edited if need.. - or just semi-human readable.. wddx_set_indent(2); $xx = wddx_serialize_value($x, "Testing X"); echo $xx; Comments Anyone..??? Regards Alan -- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com -- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.internals (#1015) next »