Search code examples
xmlxml-validationrss2

Invalid RSS Feed. Undefined media:content elements


When I run my RSS through http://validator.w3.org/feed/, I get the error message:

Sorry. This feed does not validate.

line 31, column 0: Undefined media:content element: media:hasSyndicationRights (30 occurrences) [help]
<media:hasSyndicationRights>1</media:hasSyndicationRights>

line 32, column 0: Undefined media:content element: media:licenseId (30 occurrences) [help]
<media:licenseId/>

line 33, column 0: Undefined media:content element: media:licensorName (30 occurrences) [help]
<media:licensorName/>

I have given the namespace http://search.yahoo.com/mrss/ for media.

Below is a part of the RSS feed.

<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
 <channel>
  <title>Cricket365</title>
  <atom:link href="http://cricket365.test" rel="self" type="application/rss+xml"/>
  <link>http://cricket365.test</link>
  <description>Love the game as much as we do</description>
  <language>en-US</language>
  <item>
   <title>
    <![CDATA[ England seamer Matthew Potts extends Durham deal ]]>
   </title>
   <link>http://cricket365.test/latest-news/england-seamer-matthew-potts-extends-durham-deal</link>
   <pubDate>Mon, 19 Sep 2022 19:05:24 +0000</pubDate>
   <dc:creator>News Desk</dc:creator>
   <category>
    <![CDATA[ News ]]>
   </category>
   <guid isPermaLink="false">england-seamer-matthew-potts-extends-durham-deal</guid>
   <description>
    <![CDATA[ Potts has made his international breakthrough in 2022. ]]>
   </description>
   <content:encoded>
    <![CDATA[ <p>England seamer Matthew Potts has signed a two-year contract extension with Durham.</p> <p>Potts, 23, made his Test debut at the start of the summer and has enjoyed a superb start with 18 wickets in his first four games.</p> <p>He also earned his first one-day international cap on home soil in Chester-le-Street but was only able to manage four overs as he struggled to cope with sweltering 38 degree heat.</p> <p><!-- EMBED START Image --></p> <figure id="embedded261813036"><img src='http://cricket365.test/content/uploads/2022/08/160820221660647892-768x531.jpeg' alt="Potts caught the eye with some impressive outings for his home county." data-title="Glamorgan v Durham – Royal London One-Day Cup – Final – Trent Bridge" data-copyright-holder="PA Archive" data-copyright-notice="PA Archive/PA Images" data-credit="Zac Goodwin" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px"><figcaption>Potts caught the eye with some impressive outings for his home county (Zac Goodwin/PA)</figcaption></figure> <p><!-- EMBED END Image --></p> <p>Potts, who joined the Durham set-up at just nine years old, signed a new deal which lasts until the end of the 2024 season on the eve of the three-Test series against South Africa.</p> <p>&#8220;I am delighted to sign an extension with Durham and commit a further two years to the club. I am looking forward to the future and what the club can achieve over this next period,&#8221; he said.</p> <p>Director of cricket Marcus North added: &#8220;We are thrilled that Matthew has agreed to extend his contract with us at Durham. He has continued to progress and develop in recent years and that was evident with his England call up earlier this summer.&#8221;</p> <p><script src="https://cdn.jwplayer.com/players/1VaxAgCt-YeE8dYIR.js"></script></p> ]]>
   </content:encoded>
   <media:content url="http://cricket365.test/content/uploads/2022/08/2.67371035.jpg" medium="image" type="image/jpeg" expression="full" lang="en">
    <media:title>2.67371035.jpg</media:title>
    <media:text>
     <![CDATA[ ]]>
    </media:text>
    <media:credit>PA Images</media:credit>
    <media:hasSyndicationRights>1</media:hasSyndicationRights>
    <media:licenseId/>
    <media:licensorName/>
   </media:content>
   <dcterms:modified>2022-09-20T12:10:00+00:00</dcterms:modified>
  </item>
 </channel>
</rss>

Solution

  • You can find some useful information here: Invalid RSS Feed. Undefined item element: media:backLinks

    As said, maybe your XML is valid, but the namespace for media is outside of W3 standards and it is unknown to the validator. So you should validate it yourself.

    This should be OK as the RSS schema says that the validation on unknown elements should be 'lax' which means only validating them if you know what they are.

    Cheers.