Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    338
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Parsing RSS Element Contents as HTML

    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:

    Code:
    <?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!
    Last edited by nolachrymose; 12-13-2003 at 02:19 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can you show us your methods?
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    338
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.)
    Attached Files Attached Files

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by brothercake; 12-14-2003 at 05:30 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    338
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://members.lycos.co.uk/rssfeed/index.htm - use dhtml.xml (I just copied dhtml.xml from scottandrew.com for a test).

    Happy coding!
    Last edited by nolachrymose; 12-26-2003 at 02:25 PM.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    338
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •