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="ht tp://webns.net/mvcb/"
xmlns:cc="http://web.resource.or g/cc/"
xmlns="http://purl.org/rss/1.0/">
- <channel rdf:about="http ://www.instapundit .com/">
<title>Instapun dit.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:generato rAgent
rdf:resource="h ttp://www.movabletype .org/?v=2.64" />
- <items>
+ <rdf:Seq>
<rdf:li
rdf:resource="h ttp://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>JE TBLUE 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>Gle nn 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 XmlNamespaceMan ager(XmlDoc.Nam eTable)
' Attempt to get any additional namespace information from
' the feed document.
Dim URI As String =
XmlDoc.Document Element.ChildNo des(0).Namespac eURI
If URI <> "" Then
NSM.AddNamespac e("foo", URI)
strXPath = "//foo:item"
strTitle = "foo:title"
strDesc = "foo:descriptio n"
strLink = "foo:link"
strPubDate = "foo:dc:dat e"
End If
I can get to the link allright like so:
dim LinkData as string = XmlNode.SelectS ingleNode(strLi nk,
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.Select SingleNode(sTit le, 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.SelectS ingleNode(strPu bDate).InnerTex t
I get an XPathException: 'foo:dc:date' has an invalid token.
Thanks