本文介绍了如何从此XML中提取内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想知道如何从此XML中提取内容: < Item> < NewsID> 426627< / NewsID> < Category>股票市场< / Category> < NewsDate> 2016-09-16 08:59:30 GMT< / NewsDate> < link rel =canonicalhref =http://www.investing.com/news/stock-market-news/ge-wins-%241.9-bn-contract-for-uk-nuclear-植物426627\" /> < Title> <![CDATA [GE赢得英国核电厂19亿美元的合同]]> < / Title> < Body> <![CDATA [< p> Investing.com& ndash;通用电气公司(纽约证券交易所股票代码:GE)赢得了英国Hinley核电站19亿美元的供应合同。通用电气公司将提供两台1,770兆瓦的Arabelle蒸汽轮机和发电机。< br />安装到电源6百万家庭,供应7年英国60%的发电需求。< br />英国法国EDF(PA:EDF)项目包括中国通用核电公司投资80亿美元< / p>周四批准有争议的1870亿美元项目。 ]]> < image> < url> https://ca33f332e2199349c49c-dc74b5af55c9b2a1bd8891aa9e8701fc.ssl.cf1.rackcdn.com/news/world_news_2_108x81.jpg < / url> < / image> < / Body> < / Item> 我想提取Body节点中的数据,只提取其中的数据之间的[CDATA [。 我尝试过的事情: 这就是我现在尝试的: 公共类NewsController:Controller { public String URLString =https://sslnews.forexprostools的.com / server.php用户名= cmtrading&安培;密码= 3FI0ri_aw&安培;域= WWW; // GET:新闻公共ActionResult索引() {列表 解决方案 英国核电厂的1.9亿美元合同]]> < / Title> < Body> <![CDATA [< p> Investing.com& ndash;通用电气公司(纽约证券交易所代码:GE)赢得了英国Hinley核电站的 1.9亿供应合同。< br /> GE将提供两台1,770兆瓦的Arabelle蒸汽轮机和发电机。< br />安装为600万户家庭供电,供应7%英国60年的发电需求。< br />英国周四,在7月份搁置之后批准了有争议的18.17亿美元项目。法国EDF(PA:EDF)项目包括 来自中国的8亿美元投资General Nuclear Power Corp.< / p> ]]> < image> < url> https://ca33f332e2199349c49c-dc74b5af55c9b2a1bd8891aa9e8701fc.ssl.cf1.rackcdn.com/news/world_news_2_108x81.jpg < / url> < / image> < / Body> < / Item> 我想提取Body节点中的数据,只提取其中的数据之间的[CDATA [。 我尝试过的事情: 这就是我现在尝试的: 公共类NewsController:Controller { public String URLString =https://sslnews.forexprostools的.com / server.php用户名= cmtrading&安培;密码= 3FI0ri_aw&安培;域= WWW; // GET:新闻公共ActionResult索引() {列表 I wanted to know how do I extract the content from this XML:<Item><NewsID>426627</NewsID><Category>Stock Market</Category><NewsDate>2016-09-16 08:59:30 GMT</NewsDate><link rel="canonical" href="http://www.investing.com/news/stock-market-news/ge-wins-%241.9-bn-contract-for-u.k.-nuclear-plant-426627"/><Title><![CDATA[ GE wins $1.9 bn contract for U.K. nuclear plant ]]></Title><Body><![CDATA[<p>Investing.com – GE (NYSE:GE) has won a $1.9 bn supply contract for U.K.’s Hinley nuclear plant.<br />GE to supply two 1,770-megawatt Arabelle steam turbines and generators.<br />Installation to power 6 million homes, supply 7% UK's power generation needs for 60 years.<br />U.K. approved controversial £18.17 bn project Thursday, after putting it on hold in July.<br />France’s EDF (PA:EDF) project includes $8 bn investment from China General Nuclear Power Corp.</p>]]><image><url>https://ca33f332e2199349c49c-dc74b5af55c9b2a1bd8891aa9e8701fc.ssl.cf1.rackcdn.com/news/world_news_2_108x81.jpg</url></image></Body></Item>I wanted to extract the data in the "Body" node and only the one that in between the "[CDATA[".What I have tried:This is what i tried for now:public class NewsController : Controller { public String URLString = "https://sslnews.forexprostools.com/server.php?username=cmtrading&password=3FI0ri_aw&domain=www"; // GET: News public ActionResult Index() { List 解决方案 1.9 bn contract for U.K. nuclear plant ]]></Title><Body><![CDATA[<p>Investing.com – GE (NYSE:GE) has won a1.9 bn supply contract for U.K.’s Hinley nuclear plant.<br />GE to supply two 1,770-megawatt Arabelle steam turbines and generators.<br />Installation to power 6 million homes, supply 7% UK's power generation needs for 60 years.<br />U.K. approved controversial £18.17 bn project Thursday, after putting it on hold in July.<br />France’s EDF (PA:EDF) project includes8 bn investment from China General Nuclear Power Corp.</p>]]><image><url>https://ca33f332e2199349c49c-dc74b5af55c9b2a1bd8891aa9e8701fc.ssl.cf1.rackcdn.com/news/world_news_2_108x81.jpg</url></image></Body></Item>I wanted to extract the data in the "Body" node and only the one that in between the "[CDATA[".What I have tried:This is what i tried for now:public class NewsController : Controller { public String URLString = "https://sslnews.forexprostools.com/server.php?username=cmtrading&password=3FI0ri_aw&domain=www"; // GET: News public ActionResult Index() { List 这篇关于如何从此XML中提取内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-31 00:35