473,739 Members | 6,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="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

Nov 11 '05 #1
1 2403
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.c om...
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

Nov 11 '05 #2

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

Similar topics

15
2341
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 program where I am accessing data over the net.When I go to retrieve the list of blogs my program acts like it is locked up/frozen for a few seconds and then when it is done it goes back to normal. Does anyone know how I would get rid of the...
1
2573
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 error "End tag 'head' does not match the start tag 'meta'". Does any one on here have any experience with this? The script is shown below, the Neowin feed works but the google feed does not. Any help would be appreciated.
6
2370
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 file to track how many times our feed was accessed? Just to get a rough idea how manyh subscribers we have? Not sure if copying and pasting a javascript into the XML source would work.
4
4231
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
2435
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. Here's why I "think" I want to use an RSS feed, and what I'm confused about. I have one file (and one file only) on my web site that changes
5
1602
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 so on. Any thoughts on the best way to to this? <Feed> <Item> <ID>Data I need</ID> <Title>Data I need</Title> </Item>
4
1953
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
885
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 not been able to find any examples that show: 1. How to read the Last_Modified or ETag header value from the requester 2. How to set the corresponding HTTP header value, either a 302 not modified or the new Last_Modified date and/or ETag...
2
3230
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 it....///// // feed // // LOADS THE RSS FEED FOR // LOOPS THROUGH AND FORMATS/FILTERS POSTS // PULLS THE TIMESTAMP OF THE LATEST UPDATE FROM THE DB // IF THERE ARE NEW POSTS, ADD THEM TO THE DATABASE ///// public function feed($feed,$type) { if...
0
9479
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9337
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9266
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9209
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6754
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6054
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.