Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 如何使用xpath/xquery从rss提要获取图片url_Xml_Xpath_Rss_Xquery - Fatal编程技术网

Xml 如何使用xpath/xquery从rss提要获取图片url

Xml 如何使用xpath/xquery从rss提要获取图片url,xml,xpath,rss,xquery,Xml,Xpath,Rss,Xquery,以下是rss提要的一个示例: <item> <title>Stem cells being made from blood</title> <description>A patient's own blood has been used to make personalised stem cells, which doctors hope can be used to treat a range of diseases.</descripti

以下是rss提要的一个示例:

<item>
<title>Stem cells being made from blood</title>
<description>A patient's own blood has been used to make personalised stem cells, which doctors hope can be used to treat a range of diseases.</description>
<link>http://www.bbc.co.uk/news/health-20539835#sa-ns_mchannel=rss&ns_source=PublicRSS20-sa</link>
<guid isPermaLink="false">http://www.bbc.co.uk/news/health-20539835</guid>
<pubDate>Fri, 30 Nov 2012 00:45:53 GMT</pubDate>
<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" width="66" height="49" url="http://news.bbcimg.co.uk/media/images/64469000/jpg/_64469170_c0147104-red_blood_cells%2C_artwork-spl.jpg"/>
<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" width="144" height="81" url="http://news.bbcimg.co.uk/media/images/64469000/jpg/_64469171_c0147104-red_blood_cells%2C_artwork-spl.jpg"/>

干细胞是由血液制成的
病人自己的血液被用来制造个性化的干细胞,医生希望这些干细胞可以用于治疗一系列疾病。
http://www.bbc.co.uk/news/health-20539835#sa-ns_mchannel=rss&ns_source=publics20 sa
http://www.bbc.co.uk/news/health-20539835
2012年11月30日星期五00:45:53 GMT
我需要获取媒体中.jpg图片的url:缩略图。。 如何使用xpath或xquery实现这一点? 有人能帮我吗? 谢谢大家!

假设您的XML是:

<item>
  <title>Stem cells being made from blood</title>
  <description>A patient's own blood has been used to make personalised stem cells, which doctors hope can be used to treat a range of diseases.</description>
  <link>http://www.bbc.co.uk/news/health-20539835#sa-ns_mchannel=rss&amp;ns_source=PublicRSS20-sa</link>
  <guid isPermaLink="false">http://www.bbc.co.uk/news/health-20539835</guid>
  <pubDate>Fri, 30 Nov 2012 00:45:53 GMT</pubDate>
  <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" width="66" height="49" url="http://news.bbcimg.co.uk/media/images/64469000/jpg/_64469170_c0147104-red_blood_cells%2C_artwork-spl.jpg"/>
  <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" width="144" height="81" url="http://news.bbcimg.co.uk/media/images/64469000/jpg/_64469171_c0147104-red_blood_cells%2C_artwork-spl.jpg"/>
</item>
//item/*[local-name() = 'thumbnail' 
    and namespace-uri() = 'http://search.yahoo.com/mrss/']/@url