OSDN Git Service

atom adhoc fix...
authorISHIKAWA Mutsumi <ishikawa@hanzubon.jp>
Sat, 3 Nov 2012 05:46:03 +0000 (14:46 +0900)
committerISHIKAWA Mutsumi <ishikawa@hanzubon.jp>
Sat, 3 Nov 2012 05:46:03 +0000 (14:46 +0900)
lib/Mubot4FB/Atom.pm

index a801a45..5c5b1de 100644 (file)
@@ -72,16 +72,24 @@ sub add_entry {
 
 sub as_xml {
        my ($me) = @_;
-       return $me->{feed}->as_xml;
+       my $xml = $me->{feed}->as_xml;
+       # note: http://hublog.hubmed.org/archives/001290.html
+       $xml =~ s| xmlns="http://www.w3.org/2005/Atom"||g;
+       $xml =~ s| xmlns="http://purl.org/atom/ns#"||g;
+       $xml =~ s| xmlns:default="http://www.w3.org/1999/xhtml"||g;
+       $xml =~ s|<content mode="xml">|<content type="xhtml">|g;
+       $xml =~ s|<content mode="escaped">|<content type="html">|g;
+       $xml =~ s|<feed>|<feed xmlns="http://www.w3.org/2005/Atom">|;
+       return $xml;
 }
 
 sub print {
        my ($me, $fh) = @_;
 
        if (defined $fh) {
-           print $fh $me->{feed}->as_xml;
+           print $fh $me->as_xml;
        } else {
-           print $me->{feed}->as_xml;
+           print $me->as_xml;
        }
 }