We don't bite newbies here... much PerlMonks

### Re: XML::RSS and RSS2 with custom namespaces

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

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 }) +; [download] 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";
}
}
}

[download]

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!

Create A New User
Node Status?
node history
Node Type: note [id://584305]
help
Chatterbox?
 [Corion]: Do you want to launch a script and keep the command prompt/console window open? [Corion]: Do you want to wait for a key press before closing the window? [LanX]: I want the command line in the history [tye]: -Mouse [Corion]: Option a) would mean launching cmd.exe /k c:\path\to\ batchfile- launching-perl- script.cmd. Option b) would be to add pause as the last line of said batch file. [LanX]: First day after holidays ... and already stressed by the fact that colleagues changed stuff without communication ... apparently I'm the only one trying to fight entropy [Corion]: LanX: The command is always in the history if you typed it in before. If you didn't type the command into the command line, it will not be there. I think there is doskey which can stuff command lines into the history LanX damns the cult of CB ;-) LanX WTF WTF WTF [LanX]: please forget my last 3 posts

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2017-03-27 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Should Pluto Get Its Planethood Back?

Results (320 votes). Check out past polls.