Using LINQ to read opml

by: Ruwen Jin

I need read opml and translate it to my objects. Instead of work with Xml Document I use System.Xml.Linq :


using System.Xml;
using System.Xml.Linq;
XmlReader reader = new XmlTextReader(opmlUrl);
XElement opml = XElement.Load(reader);
var results = from c in opml.Element("body").Element("outline").Elements("outline")
        where c.Attribute("type").Value == "rss" && c.Attribute("xmlUrl") != null
        select new opmlItem
            Name = c.Attribute("title").Value,
            Text = c.Attribute("text").Value,
            RSS = c.Attribute("xmlUrl").Value

05 December 2007


Post a comment    
User verification Image for user verification  
EPiTrace logger