RSS to XML file? How?

by astaga
9 replies
I need to create a XML file, using the RSS feed.

Trouble is, is that I have NO idea where to even start.

Anyone comfortable with this please PM me to find out more.....
#file #rss #xml
  • Profile picture of the author stma
    Google simple xml - you'll find some examples and it's available by default with php 5+
    {{ DiscussionBoard.errors[3980609].message }}
  • Profile picture of the author ussher
    You'll need to give more info. Its unclear whether you want to do this for _your_ RSS feed from your server and so have direct access to the data coming from the database or whether it is someone elses RSS feed that you want to transform into XML structure to do something with it.

    If its the second, what is the form of the incoming RSS feed and what does the structure of the XML need to look like.
    Signature

    "Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."

    - jamroom.net
    Download Jamroom free: Download
    {{ DiscussionBoard.errors[3980763].message }}
    • Profile picture of the author astaga
      The RSS is external, from Amazon, eg. Amazon's Bestsellers. The need is to make an XML file with the data fields re-ordered to a format containing following lines:
      <?xml version="1.0" encoding="utf-8"?>
      <list>
      <list image="item1 image URL" action="URL of item on Amazon site" target="_new"
      title="item title" desc="item description (limit 200 characters"/>
      <list image="item2 image URL" action="URL of item on Amazon site" target="_new"
      title="item title" desc="item description (limit 200 characters"/>
      .etc...... repeated 20 times

      </list>


      How does one know what is coming down the feed on any RSS, if these are external feeds?
      {{ DiscussionBoard.errors[3980936].message }}
      • Profile picture of the author KirkMcD
        First, an RSS file is already an XML file.
        Originally Posted by astaga View Post

        How does one know what is coming down the feed on any RSS, if these are external feeds?
        You'll need to look at it.
        There are a limited number of RSS formats and they are all well defined, but not every field will be used. RSS at Wikipedia

        How to convert it?
        Figure out the RSS files format.
        Parse it.
        Write it out in the new format.
        {{ DiscussionBoard.errors[3982949].message }}
  • Profile picture of the author ussher
    If it was me, I would look at the structure it came down in for any structural formats that I could use, then write a script in php to re-format those structures into the format I wanted.

    Look for things like <div class="the_image"><img.........></div> then use a regular expression to match that and get the contents to output to XML.

    Someone else might have a trick to it that already has been built since it a big one like an amazon feed though.
    Signature

    "Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."

    - jamroom.net
    Download Jamroom free: Download
    {{ DiscussionBoard.errors[3981032].message }}
  • Profile picture of the author HorseStall
    RSS is XML. XML is simply extensible markup language. RSS is a defined set of tags in XML format.
    {{ DiscussionBoard.errors[3983102].message }}
  • Profile picture of the author astaga
    OK, for the "looking part", are there any "tools" that will allow me to look at the raw feed so I know what is in the stream, and know what kind of data (fields???) exists ?

    Like some sort of "peeper" (for want of a better word)???
    {{ DiscussionBoard.errors[3984298].message }}
    • Profile picture of the author PeachCoding
      Originally Posted by astaga View Post

      OK, for the "looking part", are there any "tools" that will allow me to look at the raw feed so I know what is in the stream, and know what kind of data (fields???) exists ?

      Like some sort of "peeper" (for want of a better word)???
      To get a copy of the XML file an RSS feed will return to your PHP file just create a new php file with the following code on it:

      Code:
      <?php
      $contents = file_get_contents("http://www.your_feed_url_goes_here.com/");
      echo "<textarea rows="50" cols="100">".$contents."</textarea>";
      ?>
      When you load the new php page on a browser you will get a textbox with the RSS code inside of it.

      Hope that helps.
      Signature

      Services offered: PSD to Wordpress, Joomla, Drupal Templates or Full Site, Custom PHP or C# Programming, Fix problems on any software, and more.

      You will get 25% OFF all services by mentioning the Warrior Forum. PM me here or email me to ivanphp404@gmail.com if interested and/or if you have questions.

      {{ DiscussionBoard.errors[3984417].message }}
      • Profile picture of the author astaga
        Thanks Peachcoding for that advice.

        OK, now I got something on screen using your help and I can see the various fields via a View Source. Looking at this source and laying it side by side to the XML file layout I need, it's simple to say in a humanly language what it needs to be converted to in needed XML file, but the computer doesn't understand my human language, and I don't quite know computer-speak !

        A beer to anyone who care to help, please PM me.
        {{ DiscussionBoard.errors[4013904].message }}

Trending Topics