473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Getting feed from rss 1.0

ru
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

Nov 11 '05 #1
1 2388
lots of examples at
http://www.gotdotnet.com/community/u...aspx?query=rss
--
Dino Chiesa
Microsoft Developer Division
d i n o c h @ O N L I N E . m i c r o s o f t . c o m
"ru" <ur@sx3all.be> wrote in message
news:e4********************************@4ax.com...
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

Nov 11 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Brady Love | last post by:
I am currently working an an app that will post and edit blogs on blogger. Right now I have it so I can recive a list of the blogs and the content of those blogs using Atomizer. This is my first...
1
by: Steve | last post by:
I have a script that has been modified from one that I found on the internet to display RSS feeds in html. The script works fine for most RSS feeds but there are a number that it fails on with the...
6
by: affiliateian | last post by:
Total newbie here for this so please be patient. We manually update our XML feed when we publish an article on our website. Can we add a javascript tracking pixel (from phpadsnew) into the XML...
4
by: Florian Lindner | last post by:
Hello, I'm looking for python RSS feed parser library. Feedparser http://feedparser.org/ does not seem to maintained anymore. What alternatives are recommendable? Thanks, Florian
5
by: Ed Flecko | last post by:
Hi folks, I'm trying to figure out this whole RSS feed thing. I've created my .xml file to use for my feed, and my browsers "recognize" that I have an RSS feed, and you can subscribe, etc., etc....
5
by: jerry | last post by:
Ok, I have a feed that I need to get the data from. The file is an html file that contains items. I need to step through the file, getting the first item, doing whatever, then the second item, and...
4
by: Blake Garner | last post by:
I'm looking for suggestions on how to approach generating rss feed ..xml files using python. What modules to people recommend I start with? Thanks! Blake
0
by: jakecjacobson | last post by:
I need to write a feed parser that takes a url for any Atom or RSS feed and transform it into an Atom feed. I done the transformation part but I want to support conditional HTTP requests. I have...
2
jamwil
by: jamwil | last post by:
What's up guys. I'm having some issues... I've created a method as part of my lifestreaming class which takes an rss feed, and puts the data into a database... It's fairly simple... Check...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.