Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#8 Minimal RSS 2.0 Hack

open
nobody
None
5
2004-05-20
2004-05-20
Dan
No

What's wrong?
The title element for the blog is merged with the first
item's title element. :S

PSUEDOCODE of how it should do it:

if (currentNode.nodeType == "title") {
if (!RssFeedTitle) {
tempNode = currentNode.getParentNode;
if (tempNode.nodeType == "channel") {
RssFeedTitle = currentNode.getChildNode
}
} else {
//regular item title parsing.
}
}

----
Why is above method good?
* 99.9% of RSS 2.0 feeds will define the title at the top
of the document, thus making it the first title node.
Once RSSFeedTitle is set, it is quickly stepped over and
normal parsing resumes
* Could be conditionally triggered for rss version 2.0
alone.
----
Why do I want it?
PHPWiki, my.opera.com
It messes up the title badly!
----

<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="/styles/rss.css" ?
>
<rss version="2.0">
<channel>
<title>Starving Hungry Web Designers</title>
<link>http://my.opera.com/CloCkWeRX/journal</link>
<description>If your wondering what happens when
people love open source, this is it. They starve, admist
plenty.</description>
<language>en-us</language>
<managingEditor>Daniel O'Connor</managingEditor>
<webMaster>systems@opera.com</webMaster>
<ttl>120</ttl>
<item>
<pubDate>Wed, 19 May 2004 19:37:11 GMT</pubDate>
<title>The Butterfly Effect</title>
<author>CloCkWeRX</author>
<description><![CDATA[If you haven't seen it, get a p2p
client and download it now. The sound is a bit dodgy on
the one I got my hands on, but DAMN this movie is good.
<br/>
<br/>Its up there with Matchstick Men, Adaptation,
Being John Malkovich and Fight Club. Quality, through
and through.
<br/>
<br/>Its a bit confusing at first, but happily, its a movie
that doesn't feel the need to explain itself.
<br/>
<br/>You *will* pick it up, unless you fail to pay
attention completely. And believe me, its worth it!
<br/>
<br/>Links
<br/>&lt;http://www.butterflyeffectmovie.com/&gt;
<br/>&lt;http://www.imdb.com/title/tt0289879/&gt;]]
></description>
<link>http://my.opera.com/CloCkWeRX/journal/33</link><
comments>http://my.opera.com/CloCkWeRX/journal/33#c
omments</comments><guid
isPermaLink='true'>http://my.opera.com/CloCkWeRX/journ
al/33</guid></item>
</channel>
</rss>

Discussion