11
有人能告訴我爲什麼這個程序不枚舉任何項目?它與RDF命名空間有什麼關係?LINQ to XML:應用XPath
using System;
using System.Xml.Linq;
using System.Xml.XPath;
class Program
{
static void Main(string[] args)
{
var doc = XDocument.Load("http://seattle.craigslist.org/sof/index.rss");
foreach (var item in doc.XPathSelectElements("//item"))
{
Console.WriteLine(item.Element("link").Value);
}
Console.Read();
}
}
獲獎得主,雞晚餐。 – core 2009-10-17 20:14:25
在C#中解析RDF,RSS和ATOM的完整示例可以在這裏找到http://www.jarloo.com/rumormill-5/也可以找到完整的源代碼。 – Kelly 2011-11-01 05:00:02