Re: Example from www.php.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Timothy Murphy wrote:

> I was trying Example 2147, which reads:
> -------------------------------
> <?php
> $string = <<<XML
> <a xmlns:b>
>  <foo name="one" game="lonely">1</foo>
> </a>
> XML;
> 
> $xml = simplexml_load_string($string);
> foreach($xml->foo[0]->attributes() as $a => $b) {
>     echo $a,'="',$b,"\"\n";
> }
> ?>
> -------------------------------
...
> However, in my case it outputs nothing.
> (I'm running php-5.1.6 under Fedora-6.)

I see that the example does work if I substitute
<a> for <a xmlns:b>.
[I'm not sure what effect the xmlns:b has?]

-- 
Timothy Murphy  
e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux