Need Info about RSS, XML, php parsing xml/rss feeds

Discussion in 'OT Technology' started by D1G1T4L, Dec 22, 2004.

  1. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    i am wondering what's the difference between RSS and XML
    and are there any good tutorials online to learn how to construct such files etc

    also any good tutorials on using php with xml and rss?

    thx in advance
     
  2. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    RSS is a flavor of XML like HTML is a flavor of SGML which is a flavor of XML. But don't quote me. RSS is pretty much just XML. RSS is basically a publishing format that uses XML. RSS has a collection of fields you can use to define published content. With just XML, you could go nuts defining your own fields (all of which is legal in XML) but your off the shelf RSS reader may not know how to handle all your fields you created. But if you follow the RSS format, then the off the shelf RSS reader shouldn't have any problems with your feed.

    For PHP, check out MagPieRSS (I think that's the name). Its a handy little library for reading RSS feeds. I use it on rsbauer.com.

    For generating a feed, I think there's 2 ways to do it. One, you could build a super-duper XML class and you toss your data in it and it pops out an XML document (aka: RSS feed).

    On rsbauer.com, I cheated and went with option two. I whipped up an RSS template (I'll admit, I suck at RSS so I looked at several other blogs out there with clean RSS feeds for examples). It has a header and footer and a middle section. I populate the header with the necessary info. Then I read the middle section and loop it for each article I wish to publish. Add the footer and dump it to the browser and its done. No fancy classes involved. The only memory overhead is just tied up with containing the string for the finished feed which isn't too big. Plus, I find it a ton easier to switch formats using templates. I've got an RDF feed I can use with Mozilla/Firefox and all I have to do is point my code away from the RSS template and to the RDF template (and I'm pretty sure I could go nuts and create a CSV output as well). The XML classes don't have this power from what I've seen.
     
  3. MrMan

    MrMan New Member

    Joined:
    Jul 13, 2004
    Messages:
    308
    Likes Received:
    0
    Damn, that sucks. Wouldn't you have the program, or source code locally in your computer before you upload it to your host.
    ---

    RSS is written in XML format, meaning it must be well formed like XML. I believe RSS is part of RDF, in fact RSS means RDF Site Summary. "RDF is universal format for data on the Web." (http://www.w3.org/RDF/FAQ). RDF is also written in XML format.

    I haven't read it yet, but here's a tutorial on parsing RSS.

    http://www.sitepoint.com/article/php-xml-parsing-rss-1-0
     
  4. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    "RSS is a Web content syndication format.

    Its name is an acronym for Really Simple Syndication."

    http://blogs.law.harvard.edu/tech/rss
     
  5. MrMan

    MrMan New Member

    Joined:
    Jul 13, 2004
    Messages:
    308
    Likes Received:
    0
  6. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    thx guys
     

Share This Page