Need help implementing <media:content> in RSS feed

Jules Webb
Jules Webb used Ask the Experts™
on
Hello

I am trying to create an email template for a MailChimp account that will bring in the RSS feed. Everything is coming in fine except for the post image. For other emal newsletter services I've successfully used the <enclosure> tag to bring in the post image. MailChimp is saying that I need to use the <media:content> tag. But I can't get my feed to validate using this tag. I'm not sure what I'm doing wrong.

Below is a link to my rss feed. Since it's throwing errors you'll only be able to see it from the "view-source" functionality
view-source:http://americanalpsranch.com/blog/rss

Without the <media:content> everything works fine so I must be implementing it incorrectly. Below is the rss feed with just one post showing. I've also tried just using <media:content url="" /> but that didn't work either.


<?xml version="1.0" encoding="utf-8"?>
<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><![CDATA[American Alps Ranch Blog]]></title>
        <link>http://americanalpsranch.com/blog/read/</link>
        <description></description>
        <dc:language>en</dc:language>
        <dc:creator></dc:creator>
        <dc:rights>Copyright 2013</dc:rights>
        <dc:date>2013-07-03T18:56:00+00:00</dc:date>
        <admin:generatorAgent rdf:resource="http://expressionengine.com/" />    
            
            <item>      
            
                <media:content url="http://www.webmonkey.com/monkeyrock.mpg" fileSize="2471632" type="image/*" height="150" width="150">
                    <media:title>Angus Beef Cuts Chart</media:title>
                    <media:description>See Rocking Webmonkey Garage.</media:description>
                </media:content>            
                  
                <title><![CDATA[Buying Beef in Bulk]]></title>
                
                <link>http://americanalpsranch.com/blog/read//buying-beef-in-bulk</link>
                
                <guid>http://americanalpsranch.com/blog/read//buying-beef-in-bulk#When:18:56:00Z</guid>
                
                <description><![CDATA[<p>Pasture to Plate</p><p>Live weight, Hanging weight, Packaged weight - What&rsquo;s the difference?? How can one beef have three different weights? &nbsp;It can be confusing to talk about the different weight classifications and terms applied to an animal carcass. Here are the steps from an animal grazing in the pasture to the steak on your plate and what they mean to you.<br />
                &nbsp;</p>]]></description>
                
                <dc:subject><![CDATA[Healthy Lifestyle, Industry News,]]></dc:subject>
                
                <dc:date>2013-07-03T18:56:00+00:00</dc:date>
                
            </item>
            
            <item>      
	  	
    
    </channel>
	
</rss>

Open in new window


Thanks for the assist!
Jules
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Top Expert 2016
Commented:
It looks like a namespace error.  Please see http://cyber.law.harvard.edu/rss/rss.html#extendingRss

This script gives some diagnostics that may be more helpful than what the browser can tell us.
http://www.laprbass.com/RAY_temp_juleswebb.php

<?php // RAY_temp_juleswebb.php
error_reporting(E_ALL);
echo '<pre>';

$rss = <<<EOD
<?xml version="1.0" encoding="utf-8"?>
<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><![CDATA[American Alps Ranch Blog]]></title>
    <link>http://americanalpsranch.com/blog/read/</link>
    <description></description>
    <dc:language>en</dc:language>
    <dc:creator></dc:creator>
    <dc:rights>Copyright 2013</dc:rights>
    <dc:date>2013-07-03T18:56:00+00:00</dc:date>
    <admin:generatorAgent rdf:resource="http://expressionengine.com/" />


    <item>

			<media:content url="http://www.webmonkey.com/monkeyrock.mpg" fileSize="2471632" type="image/*" height="150" width="150">
				<media:title>Angus Beef Cuts Chart</media:title>
				<media:description>See Rocking Webmonkey Garage.</media:description>
			</media:content>


	  <title><![CDATA[Buying Beef in Bulk]]></title>
      <link>http://americanalpsranch.com/blog/read//buying-beef-in-bulk</link>
      <guid>http://americanalpsranch.com/blog/read//buying-beef-in-bulk#When:18:56:00Z</guid>
      <description><![CDATA[<p>
	Pasture to Plate</p>
<p>
	Live weight, Hanging weight, Packaged weight - What&rsquo;s the difference?? How can one beef have three different weights? &nbsp;It can be confusing to talk about the different weight classifications and terms applied to an animal carcass. Here are the steps from an animal grazing in the pasture to the steak on your plate and what they mean to you.<br />
	&nbsp;</p>]]></description>
      <dc:subject><![CDATA[Healthy Lifestyle, Industry News,]]></dc:subject>
      <dc:date>2013-07-03T18:56:00+00:00</dc:date>
    </item>
    </channel>

</rss>
EOD;

$obj = simplexml_load_string($rss, "SimpleXMLElement", LIBXML_NOCDATA);
var_dump($obj);

Open in new window

HTH, ~Ray
Jules WebbFreelance Web Developer

Author

Commented:
Thanks Ray. I knew it was a namespace error, but I wasn't understanding how to deal with that. The info you provided were enough to get me going in the right direction. The two links below are the references I used

Found what name space I needed to add
http://feed2.w3.org/docs/howto/declare_namespaces.html

How to use the media namespace link
http://www.feedforall.com/mediarss.htm

I was using it correctly I just didn't declare the namespace in the <rss version="2.0"> tag at the top.

Thank you so much for pointing the way!
Most Valuable Expert 2011
Top Expert 2016

Commented:
Thanks for the points and thanks for posting those links -- very helpful!  

Best regards, ~Ray

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial