Hello, I'm developing a project where i need to access some XML files as objects, i've seen the dom_xmltree function but it makes me a tree of arrays of objects, too complicated to manipulate and hard to find the content within the object. Anyone have manipulated dinamic objects? I am reading the manual and doesnt say anything about how to create them, i'm using the normal way but when i try to create child objects it simple dont work. Let me show:
$name = $node->tagname $children = $node->children(); while($child = array_shift($children)) { $obj->$name = $child->content; } This works fine, but when i try to create a object with a xml like this <?xml version="1.0" ?> <config> <database> <host>10.0.9.250</host> <port>3306</port> <username>root</username> <password></password> <db>logs</db> </database> </config> The resulting object would be something like this stdClass Object ( [config] => stdClass Object ( [database] => stdClass Object ( [host] => 10.0.9.250 [port] => 3306 ) ) ) But i just can't create the empty object config, because there is no class for it, when i try just to $obj = $obj->$name; Php don't create the new object. Can anyone tell me how to do this? Piero "It occurred to me by intuition, and music was the driving force behind that intuition. My discovery was the result of musical perception". Albert Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php