Skip to main content
Participant
October 6, 2006
Question

Parsing RSS2 Feed

  • October 6, 2006
  • 1 reply
  • 298 views
Hi

I’m trying to parse an RSS2 feed that has an element “content:encoded” how can I access this without getting “: has caused an error”.

Thanks
    This topic has been closed for replies.

    1 reply

    Inspiring
    October 6, 2006
    Here is how I did it recently

    rss_2.xsl
    ---------
    <?xml version="1.0" encoding="iso-8859-1"?><!--
    DWXMLSource=" http://www.houseoffusion.com/groups/CF-Talk/RSS.cfm" -->
    <!DOCTYPE xsl:stylesheet [
    <!ENTITY nbsp "&#160;">
    <!ENTITY copy "&#169;">
    <!ENTITY reg "&#174;">
    <!ENTITY trade "&#8482;">
    <!ENTITY mdash "&#8212;">
    <!ENTITY ldquo "&#8220;">
    <!ENTITY rdquo "&#8221;">
    <!ENTITY pound "&#163;">
    <!ENTITY yen "&#165;">
    <!ENTITY euro "&#8364;">
    ]>
    <xsl:stylesheet version="1.0"
    xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"
    xmlns:sy=" http://purl.org/rss/1.0/modules/syndication/"
    xmlns:dc=" http://purl.org/dc/elements/1.1/">

    <xsl:output method="html" encoding="iso-8859-1"/>

    <xsl:template match="/">
    <h2><xsl:value-of select="rss/channel/title"/></h2>
    <p><xsl:value-of select="rss/channel/description" /></p>
    <ul>
    <xsl:for-each select="rss/channel/item">
    <li>
    <xsl:element name="a">
    <xsl:attribute name="href">viewLink.cfm?url=<xsl:value-of
    select="guid"/></xsl:attribute>
    <xsl:value-of select="title" />
    </xsl:element>
    </li>
    </xsl:for-each>
    </ul>
    </xsl:template>
    </xsl:stylesheet>

    Rss_feeds.cfm
    -------------
    <cfhttp url=" http://www.houseoffusion.com/groups/Flex/RSS.cfm"
    method="get" />
    <cfset HOF = XMLParse(cfhttp.filecontent)>

    <cffile action="read" file="G:\playground\rss_feeds\rss_2.xsl"
    variable="RSS_2">

    <cfoutput>#xmlTransform(HOF,RSS_2)#</cfoutput>