...

Parsing RSS Element Contents as HTML

nolachrymose
12-13-2003, 03:14 AM
I am working on a script to read my RSS feeds, and I've come across a problem: when I append the contents of a description element of an item element, for some reason it is parsed as text only, and all the HTML tags appear as text.

For instance, say I have an XML file like this:

<?xml version="1.0"?>
<rss version="0.91">
<channel>
<title>rss feed</title>
<link>http://www.blah.com</link>
<description>a nice little rss feed</description>
<language>en-us</language>
<item>
<title>Blah</title>
<description>
<p>foo</p>
<p>bar</p>
</description>
<link>http://www.blah.com/ref.htm#blah</link>
</item>
</channel>
</rss>

I take the description element (colored in red, above), and append it to a division, and when I append it to my container, it appears as "<p>foo</p><p>bar</p>" as opposed to this:

foo
bar

Any help is greatly appreciated. Thanks!

Happy coding! :)

brothercake
12-13-2003, 04:56 AM
Can you show us your methods?

nolachrymose
12-13-2003, 02:19 PM
Sure. Code is attached.

(Note: although I have some coding to handle IE, it doesn't work, so you can just skip over it - I plan on fixing it later. Also, the JavaScript isn't entirely W3C DOM conforming, but it's somewhat.)

brothercake
12-14-2003, 05:26 PM
It doesn't seem to do anything in moz .. it never gets as far as Init() - maybe you could make an online demo that works as far is it works for you, and includes the address of an RSS file already filled in, so we can see what happens.

nolachrymose
12-14-2003, 07:14 PM
http://members.lycos.co.uk/rssfeed/index.htm - use dhtml.xml (I just copied dhtml.xml from scottandrew.com for a test).

Happy coding! :)

nolachrymose
12-14-2003, 08:29 PM
Nevermind. ~fixed~

What I did was I removed the CDATA declaration and gave each description element which had XHTML content the XHTML namespace, and it worked.

Thanks! ;)

Happy coding! :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum