0

I would like to have some help with looping trough an XML file. I can loop through the file because i can get the value of everything in this file except the values under the [property] tag. I also marked it in the code of the file.

The file:

[0] => SimpleXMLElement Object ( 
[@attributes] => Array ( [ID] => theid) 
    [name] => thename
    [price] => theprice
    [URL] => theurl
    [images] => SimpleXMLElement Object ([image] => theimageurl ) 
    [description] => SimpleXMLElement Object ( ) 
    [categories] => SimpleXMLElement Object ( ) 
    [properties] => SimpleXMLElement Object ( 
        [property] => Array ( <----- all the values in this array -----
            [0] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => width ) [value] => 215 ) 
            [1] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => height ) [value] => 55 ) 
            [2] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => inch ) [value] => 16 ) 
            [3] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => size ) [value] => 215 / 55 R16 - 93V ) 
            [4] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => shortName ) [value] => NS700 16 inch ) 
            [5] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => brand ) [value] => Silverstone banden ) 
            [6] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => EAN ) [value] => 1701482155516 ) 
            ) 
    ) 
    [variations] => SimpleXMLElement Object ( ) )

PS: This is just one element of a bigger array.

Cœur
  • 37,241
  • 25
  • 195
  • 267
user3734231
  • 40
  • 1
  • 15
  • Have you tried to do anything? If so, where is your code? – hindmost Jun 19 '14 at 13:52
  • There are basic examples given in the PHP manual how to parse XML with PHP - you find them in the Simplexml section. As you ask generally, I also consider to close generally against the reference question we have for XML parsing with PHP. It also ships with tons of links to the PHP manual and other resources. Alternatively as others have commented, it's not enough to say "does not work" then dump some var_dump (esp. not with SimpleXML, show the XML instead) and say "help me" ;) – hakre Jun 19 '14 at 16:29

0 Answers0