Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Thursday November 14, 2002
03:59 PM

XML::RSS is alive and getting better.

[ #8951 ]

I took over the XML::RSS module from Jonathan Eisenkopf thinking I could make a couple of quick fixes, release a new version, and everyone would be happy.

Instead, all sorts of other people came out of the woodwork with even more things to add. I just added them to the SourceForge project, which now has 6 members, and some of them have already committed their own changes.

I cleared one of the tickets in RT, and now I have one left, but one of the project members has a patch for this too. It is a little more complicated so I cannot clear the ticket right away.

Anyone interested in working on some part of XML:RSS? We could use help with almost anything, including maintaining a useful and visually pleasing website, tutorial writer, and project historian. Let's make XML::RSS the gold standard again. Volunteers?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • perl -MXML::RSS -MLWP::Simple -MData::Dumper -le '$t = get(""); $x = new XML::RSS; $x->parse($t); for (keys %{$x->{namespaces}}) { next if $_ eq "rdf" || $_ eq "#default" || exists $x->{modules}{$x->{namespaces}{$_}}; $x->add_module(prefix => $_, uri => $x->{namespaces}{$_}) }; $x = new XML::RSS; $x->parse($t); print Dumper $x->{items}[0]'

    This auto-populates the namespaces with the declared namespaces. So this file has:


    • That's a pretty long one-liner :)

      Let me restate the request to see if I understand what you want:

      XML::RSS should access Freshmeat's feed and automatically pull out whatever is in xmlns:fm, then add that as a module.

      I do not want to do that for every object. Perhaps a more specific method like "add_freshmeat" so the module only loads LWP if you specifically want that to happen.

      I can also add any common, but missing, namespaces to the default list.

      I'm fairly new to the RSS world, so someone needs

      • No, lemme try again.

        I just want to have add_module() called automatically for every nonstandard module in the feed. The real important code is here:

        # loop over existing namespaces
        for my $ns (keys %{$rss->{namespaces}}) {
           # skip default namespaces
           next if $ns eq "rdf"
                || $ns eq "#default"
                || exists $rss->{modules}{ $ns->{namespaces}{$ns} };
           $rss->add_module(prefix => $ns, uri => $rss->{namespace