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 ]

kellan (905)

  (email not shown publicly)

Journal of kellan (905)

Sunday July 28, 2002
08:07 PM

Why doesn't XML::RSS encode entities?

[ #6706 ]

Why doesn't XML::RSS encode entities automatically when outputting XML? (or with a flag?) If I parse an RSS file with XML::RSS I get a nice datastructure out that I can tweak and play with, but if I want to pass that datastructure back into XML::RSS I have to worry about walking the mess of nested hashes, and re-encoding every stray ampersand.

Not so hard you say? True. Simply in fact. I can cut and paste lines 658 thru 897 out of XML::RSS and into my script, and then add a handful of calls to encode(). Somehow though, cutting and pasting 240 lines into my script seems the wrong way to go.

Is there a logic behind this that I'm missing? In general its a very nice module, and I feel like maybe I'm over looking a perfectly valid reason for building a tool that encourages broken XML.

Any insights appreciated. Thanks.

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.
  • Why doesn't XML::RSS encode entities automatically when outputting XML?

    I've wondered that, myself, many times. But I was (and am) too lazy to cook up a simple "see, look at this" test case to mail to the author.

    • I think the author knows. Digging deeper on CPAN I found a 9 month old open bug on this very issue. The example case is pretty simple.

      my $rss_in = new XML::RSS();
      my $rss_out = new XML::RSS();
      $rss_out->add_item( $rss_in->{'items'}[0] );

      I got email from someone who says they have a DWIM patch. If that falls through and I can't find a good reason for the current behaviour I'll write one.