Posted By: VB Man | Nov 27th, 2008 @ 7:50 PM
page 1 of 1
Comments: 6 | Views: 666
VB Man
VB Man
Year of the Linux MCE.
Is there a built in .net class that can handle rdf xml docs?

I've been trying to parse this page : http://sanantonio.craigslist.org/sys/index.rss for quite some time but I can't figure it out.

Cupiditas
Cupiditas
Chris Hawkins
There's no built in class (unless you consider the XmlReader et al to be helpful here) but there's libraries on Codeplex and the like.
Cupiditas
Cupiditas
Chris Hawkins

Looks valid to me. Internet Explorer picks it up fine.

You could always do this:

XmlDocument doc = new XmlDocument();
doc.Load(rssUrl);

foreach(XmlNode node in doc.FirstChild.ChildNodes)
{
    if(node.Name == "channel")
    {
        // etc: I'll leave the rest up to your imagination
    }
}
PerfectPhase
PerfectPhase
"This is not war, this is pest control!" - Dalek to Cyberman
Because the first child is '<?xml version="1.0" encoding="ISO-8859-1"?>'

Try this

<BR>XDocument doc = XDocument.Load("http://sanantonio.craigslist.org/sys/index.rss");<BR>XNamespace rdf = "http://purl.org/rss/1.0/";<BR>foreach (var node in doc.Root.Elements(rdf + "channel"))<BR>{<BR>    Console.WriteLine(node.Name);<BR>}
page 1 of 1
Comments: 6 | Views: 666
Microsoft Communities