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条回答 默认 最新

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部