循环遍历XML文件

时间:2014-06-19 13:43:38

标签: php arrays xml loops

我想通过循环XML文件获得一些帮助。 我可以遍历文件,因为除了[property]标签下的值之外,我可以获得此文件中所有内容的值。我还在文件的代码中标记了它。

文件:

[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:这只是一个更大数组的一个元素。

0 个答案:

没有答案