If I read correctly in the manual page it is possible to add Dublin Core (DC) metadata to RSS 2.0 feeds, even via the XML::RSS module. I seem to be missing something.

#!/usr/bin/perl use XML::RSS; use strict; use warnings; my $rss = XML::RSS->new (version => '2.0'); $rss->channel(title => 'Example Corp, Inc', link => 'http://example.com', language => 'en', description => 'a one-stop-shop for all your Linux', ); $rss->add_item(title => "GTKeyboard 0.85", permaLink => "http://example.com/1999/06/21/93.html", description => 'blah blah', dc => { creator => 'an author', contributor => 'an editor', }, ); print $rss->as_string; exit(0);
If I run that, I get the following, without the Dublin Core. I was expecting the Dublin Core metadata elements to somehow show up.
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" > <channel> <title>Example Corp, Inc</title> <link>http://example.com</link> <description>the one-stop-shop for all your Linux</description> <language>en</language> <item> <title>GTKeyboard 0.85</title> <description>blah blah</description> <guid isPermaLink="true">http://freshmeat.net/news/1999/06/21/93.html< +/guid> </item> </channel>

I see that xmlns:dc="http://purl.org/dc/elements/1.1/" is missing from the RSS element.

Perhaps I have to add the namespace

If so, how do I add it for RSS 2.0, not 1.0? The module seems to accept both legitimate DC elements as well as random stuff when making objects but does not print them.

----

Edit:

I've also tried,

my $rss = XML::RSS->new (version => '2.0', 'xmlns:dc'=>"http://purl.org/dc/elements/1.1/ +", );

and

my $rss = XML::RSS->new (version => '2.0', namespaces => { 'xmlns:dc'=>"http://purl.org/ +dc/elements/1.1/" }, );

Neither produce any visible changes, even using Data::Dumper.


In reply to Adding Dublin Core to RSS 2.0 via XML::RSS? by mldvx4

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.