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 :-)
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
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 ){
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
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
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
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'] ; /
7 matches
Mail list logo