Re: [PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread Red Wingate
Guess it was quite luck i saw the little note in the documentation: Note: SimpleXML has made a rule of adding iterative properties to most methods. They cannot be viewed using var_dump() or anything else which can examine objects. Guess i will have to take a look at my config parser again :-)

Re: [PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread Dan Phiffer
Red Wingate wrote: So, this one will work out quite well ( maybe one should take a look at the documentation of attributes() :-) Wow I can't believe I missed that. Hehe. I guess the lesson here is don't always trust what you get from print_r(). Thanks for the responses, -Dan foreach ( $xml->lib

Re: [PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread Red Wingate
So, this one will work out quite well ( maybe one should take a look at the documentation of attributes() :-) foreach ( $xml->lib_error->param AS $param ) { $n = 0 ; while ( is_object ( $xml->lib_error->param[$n] ) ) { foreach( $xml->lib_error->param[$n]->attributes() AS $a => $b ){

Re: [PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread Dan Phiffer
John W. Holmes wrote: Have you seen Example 4 here: http://us2.php.net/manual/en/ref.simplexml.php Not sure if that helps or not, though, but it looks like it's already an associative array. It certainly looks like an associative array, but the array_keys() function chokes on it: Warning: array

Re: [PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread Dan Phiffer
Red Wingate wrote: FALSE > $xml = simplexml_load_file( 'config.xml' ); foreach ( $xml->lib_error->param AS $id => $param ) { echo $param['name'] ; // will output 'boolean' ! } I think you mean that would output 'error_logfile_write'. However, what I'm asking is i

Re: [PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread John W. Holmes
From: "Dan Phiffer" <[EMAIL PROTECTED]> > I have what I hope to be a simple question about SimpleXML. Is it > possible to get the attributes of a SimpleXML node as an associative array? > > Consider the following: > > $sxe = simplexml_load_string(''); > print_r($sxe->attributes()); > // Gives: si

Re: [PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread Red Wingate
There is a way, but somehow i don't like it though ( but you can find this in the documentation ): This is config.xml: FALSE And my Testfile: $xml = simplexml_load_file( 'config.xml' ); foreach ( $xml->lib_error->param AS $id => $param ) { echo $param['name'] ; /

[PHP] PHP 5: SimpleXML attributes

2004-04-07 Thread Dan Phiffer
Hello, I have what I hope to be a simple question about SimpleXML. Is it possible to get the attributes of a SimpleXML node as an associative array? Consider the following: '); print_r($sxe->attributes()); // Gives: simplexml_element Object ( [0] => value ) ?> Is there some way to find out that