http://qs321.pair.com?node_id=584305


in reply to XML::RSS and RSS2 with custom namespaces

So as it says in the docs, you can add namespaces with the add_module method:

$rss->add_module(prefix=>'my', uri=>'http://purl.org/my/rss/module/' +); $rss->add_item (title=>$title, link=>$link, my=>{ rating=>$rating }) +;
Updated: Meh, didn't see the 1.0-only restriction in reading the module code the first time. My bad. Looks like you could just add it in. It's this section:

# Ad-hoc modules while ( my($url, $prefix) = each %{$self->{modules}} ) { next if $prefix =~ /^(dc|syn|taxo)$/; while ( my($el, $value) = each %{$self->{channel}->{$prefix}} +) { if ( exists( $rdf_resource_fields{ $url } ) and exists( $rdf_resource_fields{ $url }{ $el }) ) { $output .= qq!<$prefix:$el rdf:resource="! . $self->encode($value) . qq!" />\n!; } else { $output .= "<$prefix:$el>". $self->encode($value) ."< +/$prefix:$el>\n"; } } }

BTW, you do realize that XML::RSS uses XML::Parser, which depends upon expat, which is not pure perl?


The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

Replies are listed 'Best First'.
Re^2: XML::RSS and RSS2 with custom namespaces
by BaldPenguin (Friar) on Nov 15, 2006 at 22:35 UTC
    That snippet is in the as_rss_1_0 subroutine. I guess I could easily hack the module to work correctly, I was wondering if it was something someone else had conquered already and prevent tampering with the module as it sits in CPAN.

    I misspoke earlier, as my requirements get longer to explain: I need modules that are PP or do not require the compilation of modules not already on my hosting platform. They will not add anymore perl modules in the common area so I am missing such essentials as DateTime and XML::LibXML.

    Don
    WHITEPAGES.COM | INC
    Everything I've learned in life can be summed up in a small perl script!

      Just a thought: Could you tear out the relevant code from XML::RSS and just paste it in your script? Ugly I know, but it sounds like you are in one of those "Yes we know a simple act can facilitate an increase in your productivity, but what we need to know is are you willing to do it against all odds and still meet labor standards?"

Re^2: XML::RSS and RSS2 with custom namespaces
by BaldPenguin (Friar) on Nov 15, 2006 at 21:55 UTC
    In fact that is what is in my code, however it only works for the RSS1 feeds, as documented. Feeds like itunes and yahoo, require RSS2 feeds. Thus, my problem.

    Don
    Everything I've learned in life can be summed up in a small perl script!