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

 
Developer Updates  
Free Website Content 
 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: starstarstarstarstar / 11
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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
     

       

    XML ARTICLES

    - Flex Array Collection Sort and Filtering
    - The Flex Tree Control
    - Flex List Controls
    - Working with Flex and Datagrids
    - 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...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT