Re: Adressing XML Objects

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

 



On Wed, Jan 7, 2009 at 3:10 PM, Merlin Morgenstern <merlin_x@xxxxxxxxxxx> wrote:
> Hi there,
>
> I am justing walking my first steps on XML and PHP. As I learned from a
> tutorial adressing is very simple:
>
> echo $xml->anbieter->immobilie->preise->kaufpreis;
>
> I simply just can't figure out how to adress this structure:
> <anhang location="INTERN" gruppe="TITELBILD">
>
> This does not work:
> echo $xml->anbieter->immobilie->anhaenge->daten->anhanginhalt;
>
> Somehow location and gruppe needs to be placed into the command. I already
> tried a couple of version, but no success.
>
> Thank you for any hint.
>
> Best regards, Merlin
>

I haven't used SimpleXML too much, but aren't you just looking for this?

$attributes = $xml->anbieter->immobilie->anhaenge->daten->anhanginhalt->anhang->attributes();

echo $attributes['location'], "\n";
echo $attributes['gruppe'], "\n";

http://www.php.net/manual/en/function.simplexml-element-attributes.php

Andrew

-- 
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