Home arrow Delphi-Kylix arrow Page 2 - Creating an RSS Reader
DELPHI-KYLIX

Creating an RSS Reader


Everyone who owns a website would have heard about the RSS phenomenon. Now you will get the opportunity to create your own RSS reader that will enable you to download and view RSS files on your desktop. This application will enable you to read RSS feeds from the Internet with the added advantage of being able to download XML files to your local hard drive.

Author Info:
By: Jacques Noah
Rating: 4 stars4 stars4 stars4 stars4 stars / 8
August 16, 2006
TABLE OF CONTENTS:
  1. · Creating an RSS Reader
  2. · Code
  3. · Web Browser Code
  4. · Navigation Code

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Creating an RSS Reader - Code
(Page 2 of 4 )

Start a new application and add the following:

Component

Tab

Rename

Align

Toolbar       

Win32

Toolbar1

alTop

TTreeview

Win32

Tv1

alLeft

TSplitter

Additional

Splitter1

alLeft

TWebbrowser

Internet

wb

alClient

StatusBar

Win32

Statusbar1

alBottom

TSpeedButton

Additional

SpeedButton1

auto

TSpeedButton

Additional

SpeedButton2

auto

TSpeedButton

Additional

navBack

auto

TSpeedButton

Additional

navForward

auto

TSpeedButton

Additional

wbHome

auto

TSpeedButton

Additional

wbStop

auto

TSpeedButton

Additional

wbRefresh

auto

You should have something like this:

Once all of the above is set, double click on the OnCreate event and add the following code:

procedure TForm1.FormCreate(Sender: TObject);
var
rec:TSearchRec;
SomeTxtFile : TextFile;
buffer : string;

begin
//read links from links file   ***********************************
with tv1.Items.AddFirst(  nil,  'RSS Links'  ) do
begin
Selected := true;
end;
if fileexists('links.txt')  then begin
AssignFile(SomeTxtFile, 'links.txt');
Reset(SomeTxtFile);
while not EOF(SomeTxtFile) do begin
ReadLn(SomeTxtFile, buffer);
with tv1.Items.AddChildFirst(  tv1.Selected,  buffer) do
begin
MakeVisible;
end;
end;
CloseFile(SomeTxtFile);
end //fileexists
else begin
with tv1.Items.AddFirst(  nil,  'No RSS Links Found'  ) do
begin
Selected := true;
end;
end ;
end;

The above code basically loads the RSS links from a textfile that is located on the local disk and adds them to the treeview. You can only view these links once you are connected to the Internet. Next, double click on the OnDblClick event of the treeview component and add the following code:

procedure TForm1.tv1DblClick(Sender: TObject);
begin
if (tv1.Selected.Level <> 0) then begin
fn:=tv1.Selected.Text;
form1.Caption:='';
//update the form caption
form1.Caption:='RSS XML File Reader - '+fn;
wb.Navigate(fn);
end;
end;

All that happens in the above code is that it basically navigates the selected RSS link to the WebBrowser component. The link name is captured in the "fn" variable and then the form caption is updated with it. Then the program gets the RSS data from the Internet link (stored in the fn variable) and displays the contents in the WebBrowser component


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 2 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials