Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: XML::RSS and RSS2 with custom namespaces

by idsfa (Vicar)
on Nov 15, 2006 at 21:48 UTC ( [id://584305]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://584305]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-29 08:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found