XML
  Home arrow XML arrow Page 3 - Creating an RSS Reader Application
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Rational Software Development Conference
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

Creating an RSS Reader Application
By: Jacques Noah
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 7
    2007-02-20

    Table of Contents:
  • Creating an RSS Reader Application
  • Code
  • Parsing the RSS document
  • Creating an enhanced RSS document

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    Creating an RSS Reader Application - Parsing the RSS document
    (Page 3 of 4 )

    The next function just parses the RSS document that is allocated it.

    function showparsedContents($thelocation){
      parsefile($thelocation);
    }

    When the "Create RSS document" link is selected, a function called choicefrm() is activated. This function displays a form that requests a name for the RSS document that you want to create, and also requests that you choose between a simple RSS document or an enhanced one.

    Fig 2. A form that request what type of  RSS document to create...

    Then based on your choice, one of the two forms are displayed. Now, let's say you chose a simple version. A function called simplefrm() will be activated which will request that you enter the required information. Here's a screen shot:

    Fig 3. Simple RSS Document information form...

    When you submit the form, the do_simpfrm() function is called, which processes the form variables and then creates the RSS document. Here's the function that does all that:

    function do_simpfrm($filename,$mtitle,$mlink,$mdesc,$t1,$l1,
    $txt1,$t2,$l2,$txt2,$t3,$l3,$txt3){

      //Create the file
     
    if($fp = fopen($filename,"a+")){
       
    //write in the file
       
    fwrite($fp,"<?xml version='1.0'?>rn");
       
    fwrite($fp,"<rss version='2.0'>rn");
       
    fwrite($fp,"<channel>rn");
       
    fwrite($fp,"<title>".$mtitle."</title>rn");
       
    fwrite($fp,"<link>".$mlink."</link>rn");
       
    fwrite($fp,"<description>".$mdesc."</description>rn");
       
    fwrite($fp,"<item>rn");
       
    fwrite($fp,"<title>".$t1."</title>rn");
       
    fwrite($fp,"<link>".$l1."</link>");
       
    fwrite($fp,"<description>".$txt1."</description>rn");
       
    fwrite($fp,"</item>rn");
       
    fwrite($fp,"<item>rn");
       
    fwrite($fp,"<title>".$t2."</title>rn");
       
    fwrite($fp,"<link>".$l2."</link>rn");
       
    fwrite($fp,"<description>".$txt2."</description>rn");
       
    fwrite($fp,"</item>rn");
       
    fwrite($fp,"<item>rn");
       
    fwrite($fp,"<title>".$t3."</title>rn");
       
    fwrite($fp,"<link>".$l3."</link>rn");
       
    fwrite($fp,"<description>".$txt3."</description>rn");
       
    fwrite($fp,"</item>rn");
       
    fwrite($fp,"</channel>rn");
       
    fwrite($fp,"</rss>");
       
    fclose($fp);
       
    echo "The RSS document <b>" .$filename. "</b> has been created and stored.";
     
    }else{
       
    echo "The file could not be created due to a system error";
     
    }
    }

    And with that a simple RSS document is created.

    More XML Articles
    More By Jacques Noah


       · Hope you enjoyed my article. Any comments are very welcome
     

       

    XML ARTICLES

    - How to Set Up Podcasting and Vodcasting
    - Creating an RSS Reader Application
    - Building an RSS File
    - An Introduction to XUL Part 6
    - An Introduction to XUL Part 5
    - An Introduction to XUL Part 4
    - An Introduction to XUL Part 3
    - An Introduction to XUL Part 2
    - An Introduction to XUL Part 1
    - XML Matters: Practical XML Data Design and M...
    - Practical XML Data Design and Manipulation f...
    - SimpleXML
    - XForms Basics, Part 3
    - XForms Basics, Part 2
    - XForms Basics

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway