ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

RSS and CDATA issue

October 16, 2008 4:59pm

Subscribe [3]
  • #1 / Oct 16, 2008 4:59pm

    Mattbl34

    32 posts

    Hey all:

    I’m having some trouble with an RSS feed…

    I wanted to make the content in the RSS show with formatting, just like the rest of the world. So, I used CDATA to make it display, as per some suggestions on this forum. However, in my RSS feed, the CDATA displays, the actual code…

    Have a look:

    [CDATA[

    The power of visual storytelling (or visual journalism) is extraordinary, not that I need to remind you. Photographers have to use new tools as they become available; they must take advantage of advancements in technology before others have seized the opportunity.

    I often think about creating models and ideas to present to you. I view you as a board of directors for Vewd. (You do tell me what to do often enough.) It would work something like this: I bring an idea here to this forum � a strange idea using a technology you may know nothing about � and I then invite your opinions.

    Would this be an interesting thing to invest time in? Should we make an effort to develop this? How would you use it? I am interested in orchestrating things we will all benefit from, so why not bring it to you before I invest the time and money? Why not let you help me create this from the start? Why not look to you to improve it?

    I intend to do that and more in the future.

    For now, I want to hear your most outlandish ideas about a tool. If you could have a tool that did ANYTHING, what would that tool be?
    ]]

    That CDATA was copied and pasted from Google Reader… any suggestions?

  • #2 / Oct 17, 2008 12:38pm

    Capt.Mike

    69 posts

    Hi,
    The folowing may help you. You might have to check your code.

    I have an rrs template for a non ee site. The code looks like:

    <?xml version="1.0" encoding="iso-8859-1"?>
    
    <rss version="2.0"
    xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    
    
    <channel>
    <atom:link href="http://www.vivianfoate.com/vivi_listings/listings/rss.xml" rel="self" type="application/rss+xml" >
    <title>Panama City Beach Homes and Condos For Sale!</title>
    <link>http://www.vivianfoate.com</link>
    <description>Real estate property listings for sale in Panama City Beach, Panama City and Bay County-Prudential Shimmering Sands.</description>
    <language>en-us</language>
    
    <!-- template insert : $list$ -->
    <!-- templatecell : row_image -->
    <item>
    <title>$lfield3$-$lfield8$ MLS#$lfield2$, $lfield1$</title>
    <description><![CDATA[$listing_url$/images/$listing_num$_1.jpg</a>
    <span>$lfield6$</span>]]></description>
    <link>$listing_url$/$listing_file$</link>
    <guid isPermaLink="true">$listing_url$/$listing_file$</guid>
    <source url="http://www.vivianfoate.com/vivi_listings/listings/rss.xml">Panama City Beach Homes and Condos For Sale!</source>
    </item> 
    </channel>
    </rss>

    The the validate feed looks like: http://www.vivianfoate.com/vivi_listings/listings/rss.xml

    Hope that maybe helps.

  • #3 / Oct 17, 2008 12:57pm

    Capt.Mike

    69 posts

    I think I may have missed your point. If you want to stylize your rss maybe this will help: http://www.oreillynet.com/pub/a/network/2005/07/01/rss.html

  • #4 / Oct 18, 2008 3:23am

    Mattbl34

    32 posts

    Well, it all displays just fine, except the CDATA shows in each post.. That isn’t the code, but what the user sees in the browser/RSS feed reader. It looks fine, with the only exception being the CDATA (and the strange lost character issues…) but the CDATA is most important for me right now.

    Any advice, besides creating a CSS for the RSS? Is that normal practice?

  • #5 / Oct 18, 2008 8:47am

    Derek Jones

    7561 posts

    You might be missing an opening or closing bracket, it’s pretty common.  Do you have a link to the feed?  If you do not, open the feed in Firefox, and View / Source, and cut and paste a sample entry here.

  • #6 / Oct 18, 2008 1:18pm

    Mattbl34

    32 posts

  • #7 / Oct 18, 2008 2:25pm

    Capt.Mike

    69 posts

  • #8 / Oct 18, 2008 7:06pm

    Mattbl34

    32 posts

    I was missing a P tag.. And the encoding (which is set by EE) has an issue.

    I still have the same issue, however…

    ! [CDATA[
    
    The Open Society Institute (OSI) began its Moving Walls project in 1998, and since then has featured the work of more than 100 photographers. OSI is a private foundation that "aims to shape public policy to promote democratic governance, human rights, and economic, legal, and social reform."
    
    Moving Walls are "an artistic interpretation of the obstacles — such as political oppression, economic instability, and racism — that society often erects and the struggles to tear those barriers down." You can easily see how this project supports their commitment to social justice and human rights.
    
    OSI's Documentary Photography initiative offers Moving Walls grants, distribution grants to individuals and production grants to organizations. You can read about all three grants here . I had trouble finding specific information on the Production and Distribution grants, however I found plenty of information about the Moving Walls grant.
    
    Photographers are encouraged "to submit documentary work of national or international subjects that coincide with the issues and geographical areas that are principally of concern to OSI." There is no fee to apply.
    
    Grants cover your approved submitted budget for printing, drymounting, and other production costs, a $1,500 royalty payment, and covers costs up to $750 to return your work. Works will be displayed at their exhibition opening October 1, 2009. Previous grantees include Dana Popa , Marcus Bleasdale , and especially notably, Steve Liss .
    
    You can read all the specifics on the application process , but keep in mind that the application/proposal deadline is Friday, December 5, 2008.
    ]]
  • #9 / Oct 19, 2008 6:27pm

    Derek Jones

    7561 posts

    Do you have a link to the ExpressionEngine template itself, not rendered through Google’s proxy feed server?  Your template above is showing the proper CDATA character string, but your rendered feed is missing brackets, has extra whitespace, etc.

  • #10 / Oct 19, 2008 6:30pm

    Mattbl34

    32 posts

  • #11 / Oct 19, 2008 6:40pm

    Derek Jones

    7561 posts

    And what, exactly, is your full template code?  The output here is completely invalid, and again, your CDATA tags are missing brackets, have extra whitespace, the feed itself won’t render and can’t be checked because there’s a character that cannot be mapped to a valid utf-8 value, amid other issues.

  • #12 / Oct 19, 2008 6:48pm

    Mattbl34

    32 posts

    Really? I have no idea how this is happening! AHhhhh!

    Below is my full template code:

    {assign_variable:master_weblog_name="blog"}
    {exp:rss:feed weblog="generalblog"}
    
    <?xml version="1.0" encoding="{encoding}"?>
    <rss version="2.0"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:admin="http://webns.net/mvcb/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
        <title>{exp:xml_encode}Vewd.org - For documentary photographers.{/exp:xml_encode}</title>
        <link>http://www.vewd.org</link>
        <description>{weblog_description}</description>
        <dc:language>{weblog_language}</dc:language>
        <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
        <dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        <admin:generatorAgent rdf:resource="http://expressionengine.com/" >
        {exp:weblog:entries weblog="photographerfeature|generalblog|leaders|latestnews" rdf="off" dynamic_start="on" disable="member_data|trackbacks"}
        <item>
         <title>{exp:xml_encode}{if weblog_id == "4"}{essay_title} - {title} {if:else}{title}{/if}{/exp:xml_encode}</title>
    <link>{if weblog_id == "13"}{url_title_path=news/article}{/if}{if weblog_id == "11"}{url_title_path=news/article}{/if}{if weblog_id == "12"}{url_title_path=news/photographer_profile}{/if}{if weblog_id == "4"}{url_title_path=photo/essay}{/if}</link>     
     <guid>{if weblog_id == "13"}{url_title_path=news/article}{/if}{if weblog_id == "11"}{url_title_path=news/article}{/if}{if weblog_id == "12"}{url_title_path=news/photographer_profile}{/if}{if weblog_id == "4"}{url_title_path=photo/essay}{/if}</guid>
          <description>! [CDATA[ <img>{leadphoto}{article_photo}</img>{lead_about}{article_body}{biography} ] ]</description>
          <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        </item>
    {/exp:weblog:entries}
        </channel>
    </rss>
    
    {/exp:rss:feed}
  • #13 / Oct 19, 2008 6:57pm

    Derek Jones

    7561 posts

    Couple things that jump out:

    ! [CDATA[

    The correct start for a CDATA block is:

    <![CDATA[

    Also the ending is not:

    ] ]

    But:

    ]]>

    You’re also using the image tag improperly:

    <img>{leadphoto}{article_photo}</img>[/quote]

    <img> is a single, self-closing tag.  It does not have an opening and closing tag, and does not contain any data.  The correct usage is:

    <a href="http://example.com/image.jpg">http://example.com/image.jpg</a>

    But I think your primary issue is the incorrect CDATA opening and closing sequence.  Fix that and the main issue should be resolved.

    Secondary is the invalid character.  Were the entries imported from another system, a different database server (or version) or did you change the character set for your installation at one point?

  • #14 / Oct 19, 2008 7:00pm

    Capt.Mike

    69 posts

    Looks like you got some spaces in there:

    <description>! [CDATA[ <img>{leadphoto}{article_photo}</img>{lead_about}{article_body}{biography} ] ]</description>

    Should be :

    <description>![CDATA[<img>{leadphoto}{article_photo}</img>{lead_about}{article_body}{biography}]]</description>

    See if that helps.

  • #15 / Oct 19, 2008 7:04pm

    Derek Jones

    7561 posts

    Thanks, Capt. Mike, but you’re still missing some necessary characters; please see my post above. 😉

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases