Hello,
I'm trying to parse a rss 1.0 docoment like the following example from
http://www.instapundit.com:
<?xml version="1.0" encoding="iso-8859-1" ?>
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:cc="http://web.resource.org/cc/"
xmlns="http://purl.org/rss/1.0/">
- <channel rdf:about="http://www.instapundit.com/">
<title>Instapundit.com</title>
<link>http://www.instapundit.com/</link>
<description />
<dc:language>en-us</dc:language>
<dc:creator />
<dc:date>2003-09-28T22:39:45-05:00</dc:date>
<admin:generatorAgent
rdf:resource="http://www.movabletype.org/?v=2.64" />
- <items>
+ <rdf:Seq>
<rdf:li
rdf:resource="http://www.instapundit.com/archives/011739.php" />
</rdf:Seq>
</items>
</channel>
- <item rdf:about="http://www.instapundit.com/archives/011739.php">
<title />
<link>http://www.instapundit.com/archives/011739.php</link>
<description>JETBLUE PASSENGERS are unhappy about it sharing their
personal data. Interestingly, Wesley Clark is on the board of Acxiom,
the company involved, according to this story in the Post. Clark
didn't have a specific role with JetBlue, it says, but he was behind
the development of the passenger-information database
involved....</description>
<dc:subject />
<dc:creator>Glenn Reynolds</dc:creator>
<dc:date>2003-09-28T22:39:45-05:00</dc:date>
</item>
-</rdf:RDF>
Here's part of my code:
Dim NSM As New XmlNamespaceManager(XmlDoc.NameTable)
' Attempt to get any additional namespace information from
' the feed document.
Dim URI As String =
XmlDoc.DocumentElement.ChildNodes(0).NamespaceURI
If URI <> "" Then
NSM.AddNamespace("foo", URI)
strXPath = "//foo:item"
strTitle = "foo:title"
strDesc = "foo:description"
strLink = "foo:link"
strPubDate = "foo:dc:date"
End If
I can get to the link allright like so:
dim LinkData as string = XmlNode.SelectSingleNode(strLink,
NSM).InnerText
I'm having trouble getting data out of the title and date nodes. The
title.innertext returns an empty string if I try this:
Dim sss As String = oXmlNode.SelectSingleNode(sTitle, oNSM).InnerText
I propably do have to reference the <rdf:Seq> list, but how do I do
that?
And in trying to get data from the date-node like this:
Dim q As String = XmlNode.SelectSingleNode(strPubDate).InnerText
I get an XPathException: 'foo:dc:date' has an invalid token.
Thanks