note 74615 rejected from function.simplexml-load-string by bjori

From: Date: Fri, 20 Apr 2007 09:37:40 +0000
Subject: note 74615 rejected from function.simplexml-load-string by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-125608@lists.php.net to get a copy of this message
Note Submitter: joris at vreeburg dot biz ---- $string = '<root id="1"> <images amount="3"> <image width="800" height="600">1.jpg</image> <image width="800" height="600">2.jpg</image> <image width="600" height="800">3.jpg</image> </images> </root>'; print_r(simplexml_load_string($string)); In the example above it returns: SimpleXMLElement Object ( [@attributes] => Array ( [id] => 1 ) [images] => SimpleXMLElement Object ( [@attributes] => Array ( [amount] => 3 ) [image] => Array ( [0] => 1.jpg [1] => 2.jpg [2] => 3.jpg ) ) ) But where are my width and height? Why issn't it posible to read out attributes of a node that has a value? But you can read out a node that has a sub node why is that?

« previous php.notes (#125608) next »