-1
SimpleXMLElement Object(

 [ImageFormat] => SimpleXMLElement Object(

  [@attributes] => Array(

    [DimensionCategory] => small
    [Title] => extra  
  )

  [URL] => link..
 )
)
Yoshi
  • 53,111
  • 13
  • 85
  • 102
Raphael
  • 1
  • 1

3 Answers3

2

@attributes is derived from this

<ImageFormat DimensionCategory="small" Title="extra">
  <URL />
</ImageFormat>

in another word, is attributes of a given element

see this

ajreal
  • 45,869
  • 10
  • 83
  • 118
1

It's simply part of the member name:

echo $xml->ImageFormat->{'@attributes'}['Title'];

You should use the attributes() method of the SimpleXMLElement class to access the attributes of an XML elment.

knittl
  • 216,605
  • 51
  • 293
  • 340
1

As knittl stated, it's just a member name. As a note: to access attributes in a SimpleXML node, instead of doing:

echo $xml->ImageFormat->{'@attributes'}['Title'];

One would do:

echo $xml->ImageFormat['Title'];
Community
  • 1
  • 1
Tim Cooper
  • 151,519
  • 37
  • 317
  • 271