note 103289 deleted from book.simplexml by danbrown

From: Date: Tue, 05 Apr 2011 22:57:08 +0000
Subject: note 103289 deleted from book.simplexml by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178535@lists.php.net to get a copy of this message
Note Submitter: info at jeremycarlson dot com ---- @Marcus (http://us2.php.net/manual/en/book.simplexml.php#103173) - I tried your code. Given your arrogant tone, I expected it to work well. For me, it does not. I am *NOT* a developer qualified to fix your script, but I found the following. With this XML file run through your xml2array function: <?xml version="1.0" encoding="UTF-8"?> <events_get_response> <event> <name>Event One</name> </event> <event> <name>Event Two</name> </event> <event> <name>Event Three</name> </event> </events_get_response> I got the following array on my machine running PHP 5.2.11: Array ( [event] => Array ( [value] => Array ( [name] => Array ( [value] => Event One [attributes] => Array ( ) ) [0] => Array ( [name] => Array ( [value] => Event Two [attributes] => Array ( ) ) ) [1] => Array ( [name] => Array ( [value] => Event Three [attributes] => Array ( ) ) ) ) [attributes] => Array ( [0] => Array ( ) [1] => Array ( ) ) ) ) Events #2 & #3 are not at the same level as Event #1. To access the name for event #1, I'd point to $array['event']['value']['name']['value']; To access the name for event #2, I'd point to $array['event']['value'][0]['name']['value']; That may be useful for you somehow, but it's certainly not what I would expect, nor what I need.

« previous php.notes (#178535) next »