任何人都知道在.NET微型框架中執行XMLDocument的另一種方式?顯然,我無法創建一個XmlDocument對象,所以我需要找到一個合適的替代品。另外,我也無法創建一個XmlNode對象。XmlDocument替換
我想要做的是當按下按鈕時從互聯網上的rss天氣消息(XML)中獲取信息。
//Grab wather data and display useful information.
System.Xml.XmlTextReader WeatherXML = new System.Xml.XmlTextReader(http://rss.theweathernetwork.com/weather/caab0211);
System.Xml.XmlDocument doc = new XmlDocument();
doc.Load(http://rss.theweathernetwork.com/weather/caab0211);
XmlNode node = doc.DocumentElement.SelectSingleNode("/rss/channel/item");
string attr = (node.LastChild.InnerText);
XML文檔:
`<rss version="2.0">
<channel>
<title>The Weather Network - Medicine Hat, Alberta</title>
<link>http://www.theweathernetwork.com/weather/caab0211?</link>
<description>The Weather Network - ...</description>
<copyright>copyright stuff</copyright>
<language>en-us</language>
<image>...</image>
<image>...</image>
<item>
<title>Current Weather</title>
<guid>http://www.theweathernetwork.com/weather/caab0211?ref=current_obs</guid>
<link>http://www.theweathernetwork.com/weather/caab0211?ref=current_obs</link>
<pubDate>Tue, 20 Jan 2015 11:45:00 -0500</pubDate>
<description>Overcast, -1 °C , Humidity 72% , Wind W 18km/h</description>
</item>`
我需要,去年的描述(雨,-1 ° C,溼度72%,風速w ^18公里每小時)
我不認爲你會找到一種方法來加載整個由於內存限制,.NET微內存中的XML文檔。他們似乎提供了可用於解析文檔的XmlReader類:https://msdn.microsoft.com/en-us/library/ee437373.aspx – 2015-01-20 21:26:50