Welcome GuestLogin

A Drunken Wiki

RSS RSS

A Drunken Wiki is the companion wiki to the blog "A Drunken Madman", written by Jason Brown.

Navigation




Search the wiki
»

Vaccination Saves Lives: Stop The Australian Vaccination Network


Find me on Twitter, Facebook, Google+, Pinterest and LinkedIn





Pin It






Alpha Archive Atheism Blue Mountains Climbing Cycling Development DotNet GPS Guitar HMHB JavaScript JQuery LINQ Meta MTB Music Perl Powershell RNP SharePoint Skepticism Social Media Training Ukulele Vaccines Visual Studio WebParts Woodford Festival 2011 XML

PoweredBy

Linq To XML: Namespaces

RSS
Modified on 2012/08/13 04:57 by Administrator Categorized as Development, LINQ, XML
static void Main(string[] args)
        {
            // Load the XML
            XElement rssFeed = XElement.Load(ConfigurationManager.AppSettings["sourcefeed"]);
            XNamespace content = "http://purl.org/rss/1.0/modules/content/";
                var items = from item in rssFeed.Elements("channel").Elements("item")
                        select item;
            //Console.WriteLine(items.Count());
            foreach (XElement o in items)
            {
                // parse each item
                // Console.WriteLine((object)o);
                Console.WriteLine(o.Element("title").Value);
                Console.WriteLine(o.Element(content + "encoded").Value);
                // I need the image, and I need the link
            }

            Console.WriteLine("Press something to exit, yada yada yada");
            Console.ReadKey();



        }

Links

 

ScrewTurn Wiki version 3.0.5.600. Some of the icons created by FamFamFam.