On Wed, Jan 7, 2009 at 3:10 PM, Merlin Morgenstern <merli...@fastmail.fm> 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

Reply via email to