Home arrow Delphi-Kylix arrow Page 3 - Finishing an RSS Reader
DELPHI-KYLIX

Finishing an RSS Reader


In this part of the article, we will discuss how to get an RSS file from a website, and store it on the local disk for easy viewing. This way we do not need to be connected to the Internet.

Author Info:
By: Jacques Noah
Rating: 5 stars5 stars5 stars5 stars5 stars / 4
August 23, 2006
TABLE OF CONTENTS:
  1. · Finishing an RSS Reader
  2. · New code
  3. · Getting files from a website
  4. · Full code for the RSS reader

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Finishing an RSS Reader - Getting files from a website
(Page 3 of 4 )

So our application will now let us view RSS links in a web browser. It will also let us view locally stored XML files in a list view. But we have not yet discussed how to get the RSS or XML file from a website. So let's get on with it.

In Delphi, open up form3 and add an idHTTP component from the Indy clients tab. Then rename the TEdit to "url." And put http:// in its Text property on the object inspector. Form3 should look something like this:

Double click on the button and add the following code:

procedure TForm3.btnURLClick(Sender: TObject);
var
FStream: TFileStream;
begin
FStream := TFileStream.Create('feed.xml', fmCreate);
try
IdHTTP1.Get(url.Text, FStream);
finally
FStream.Free;
form1.wb.Navigate(url.Text);
end;
close;
end;

Before downloading the file, we create a TStream object to store its content, as the code below demonstrates:

FStream := TFileStream.Create('feed.xml', fmCreate);

The filename does not have to be "feed.xml;" it can be anything you want. The next bit of code actually gets the file from the website:

IdHTTP1.Get(url.Text, FStream);

The content of the file on the Internet is written to the "feed.xml" file and stored on the local disk.


blog comments powered by Disqus
DELPHI-KYLIX ARTICLES

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials