doushui3061
doushui3061
2012-10-11 15:20
浏览 42

从解析的xml结果中缺少元素

I have a rss feed which has items in following format

<item>
  <title>How Are World's Top Investors Positioning?</title>   
  <guid>123456789</guid>
  <metadata:id>3000121785</metadata:id> 
  <metadata:thumbnail>http://thumbnails.com/abc/xyz.jpg</metadata:thumbnail> 
  <metadata:smallThumbnail>http://thumbnails.com/abc/xyz_s.jpg</metadata:smallThumbnail> 
  <metadata:largeThumbnail>http://thumbnails.com/abc/xyz_l.jpg</metadata:largeThumbnail>   
  <metadata:formatLink>mpeg4_500000_Download|http://thumbnail.com/sample_L.mp4</metadata:formatLink> 
  <metadata:formatLink>mpeg4_200000_Download|http://thumbnail.com/sample__126K.mp4</metadata:formatLink> 
  <metadata:formatLink>mpeg4_600000_Download|http://thumbnail.com/sample__500K.mp4</metadata:formatLink>   
  </item>

Upon paring using simple xml

$data =  simplexml_load_string($response);
print_r($data);

The output of print_r looks like

[item] => Array
    ( 
        [0] => SimpleXMLElement Object
        (
            [title] => How Are World's Top Investors Positioning?    
            [guid] => 123456789
        )
    )

My question is why am i missing the metadata portion from the final result and how can i get it in an array?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐