diff --git a/lib/Rss2Html/Feed.pm b/lib/Rss2Html/Feed.pm
index 4f4d0f7..b7292a5 100644
--- a/lib/Rss2Html/Feed.pm
+++ b/lib/Rss2Html/Feed.pm
@@ -176,19 +176,27 @@ sub update {
sub atom_main_link {
my ($self, $item) = @_; # XXX should probably be a method of $item
for my $link ($item->link) {
- $self->log->info("checking href ", $link->href, "\n");
- if (defined $link->rel && $link->rel ne 'alternate') {
- $self->log->info("rel ", $link->rel, " unexpected, skip");
- next;
- }
- if (defined $link->type && $link->type ne 'text/html') {
- $self->log->info("type ", $link->type, " unexpected, skip\n");
- next;
- }
- $self->log->info("match!\n");
- return $link->href;
- }
+ # workaround for https://github.com/miyagawa/xml-atom/issues/16
+ my $href = $link->href // $link->elem->getAttributeNS('http://www.w3.org/2005/Atom', 'href');
+ my $rel = $link->rel // $link->elem->getAttributeNS('http://www.w3.org/2005/Atom', 'rel');
+ my $type = $link->type // $link->elem->getAttributeNS('http://www.w3.org/2005/Atom', 'type');
+ if (!$href) {
+ $self->log->warn("href undefined, skip");
+ next;
+ }
+ $self->log->info("checking href ", $href, "\n");
+ if (defined $rel && $rel ne 'alternate') {
+ $self->log->info("rel ", $rel, " unexpected, skip");
+ next;
+ }
+ if (defined $type && $type ne 'text/html') {
+ $self->log->info("type ", $type, " unexpected, skip\n");
+ next;
+ }
+ $self->log->info("match!\n");
+ return $href;
+ }
}
sub invalidate_item_info {