Atom or RSS

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Atom or RSS

Post by kendall »

Hi,

I am building an application in which i would like to store information in an xml file. 1 of my reasons for storing the information in an xml file is to be used as a feed syndicate. Now i'm also using this file as a part of Ajax manipulation so that i wouldnt have to be going to a database all the time.

Now i have been looking at the two types of syntaxes for making up my xml....Atom and RSS. RSS i see is more popularly used however, Atom's syntax is more suited to my needs. My question is

Should i use atom's syntax specification to build my xml or should i use RSS's syntax and include my own tags to make up my xml file.

Please note the main reason i am building this xml file is to be used "ajaxly" on my site rather than having to hit a database all the time, "then" use it as a source for feeds

Thanks
Kendall
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Atom or RSS

Post by Christopher »

Why not both?
(#10850)
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: Atom or RSS

Post by kendall »

arborint wrote:Why not both?
uhm? so what....2 files?. Please explain?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Atom or RSS

Post by Christopher »

We they both provide very similar information. And there is plenty of code around that will generate both. So create code that will display your data in either format.
(#10850)
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: Atom or RSS

Post by kendall »

can you use your own tags in an RSS or ATOM syntax xml in the first place?

do popular new aggregators have the ability to accept both in any instances? I'm leaning more to atoms feed but i was worried about the popularity of it.
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: Atom or RSS

Post by arjan.top »

RSS and Atom are XML and XML is designed to be extensible, so yes you can add your own tags (this should not be a problem), but maybe you should put them in another namespace to validate

And I think most of RSS readers support both Atom and RSS ...
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: Atom or RSS

Post by kendall »

arjan.top wrote:but maybe you should put them in another namespace to validate
What do you mean by this...declaring a DTD?
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: Atom or RSS

Post by arjan.top »

Define custom namespace for custom tags, so RSS will be valid

Changed example from wikipedia:

Code: Select all

 
<?xml version="1.0"?>
<rss version="2.0" xmlns:mn="http://www.example.com/mynamespace">
  <channel>
    <title>Lift Off News</title>
    <link>http://liftoff.msfc.nasa.gov/</link>
    <description>Liftoff to Space Exploration.</description>
    <language>en-us</language>
    <pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
    <lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>Weblog Editor 2.0</generator>
    <managingEditor>editor@example.com</managingEditor>
    <webMaster>webmaster@example.com</webMaster>
    <ttl>5</ttl>
    <item>
      <title>Star City</title>
      <link>http://liftoff.msfc.nasa.gov/news/2003/ ... arcity.asp</link>
      <description>How do Americans get ready to work with Russians aboard the
        International Space Station? They take a crash course in culture, language
        and protocol at Russia's Star City.</description>
      <pubDate>Tue, 03 Jun 2003 09:39:21 GMT</pubDate>
      <guid>http://liftoff.msfc.nasa.gov/2003/06/03.html#item573</guid>
       <mn:customTag>content</mn:customTag>
    </item>
  </channel>
</rss>
 
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Atom or RSS

Post by onion2k »

kendall wrote:uhm? so what....2 files?. Please explain?
If you want to use two files, sure ... rss.php and atom.php for example. Or use one file like feed.php?format=rss and feed.php?format=atom. Or use mod_rewrite and have http://www.domain.com/feeds/rss and http://www.domain.com/feeds/atom. There's loads of ways of doing it.
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: Atom or RSS

Post by Mordred »

kendall wrote:Now i'm also using this file as a part of Ajax manipulation so that i wouldnt have to be going to a database all the time.
Database will be faster (if done right) than opening an XML file and parsing it.
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: Atom or RSS

Post by kendall »

arjan.top wrote:Define custom namespace for custom tags, so RSS will be valid
How do you create custom namespaces?
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: Atom or RSS

Post by arjan.top »

it's in my example (xmlns:mn) :wink:
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: Atom or RSS

Post by kendall »

arjan.top wrote:it's in my example (xmlns:mn) :wink:

so how do you get atom feeds to read and parse it? will it be parsed? 8O :|
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Re: Atom or RSS

Post by Maugrim_The_Reaper »

If possible use Atom - bit late really ;). But Atom has long been recognised as a fixed and standardised form of a collection in XML. Since it's standard, any feed parser will automatically support it, so additional parsing code can be either significantly reduced (requiring changes for any custom extensions to the XML) or eliminated.

There are any number of Atom parsers out there. Zend_Feed does it for example. So do Magpie, SimplePie, and countless other libraries.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Atom or RSS

Post by Chris Corbyn »

SimplePie FTW!
Post Reply