Subject: | Relative Link attributes not being processed properly |
Date: | Wed, 13 Jan 2010 09:57:16 -0800 |
To: | bug-XML-Feed [...] rt.cpan.org |
From: | Jason Wieland <jwieland [...] gmail.com> |
The link attribute does not get processed correctly from:
http://earthquake.usgs.gov/earthquakes/catalogs/7day-M5.xml
Notice the links are relative and should be appended by the base
attribute. To test here is a subset of the XML file. Just copy into a
file name 7day-M5.xml
<?xml version="1.0"?>
<feed xml:base="http://earthquake.usgs.gov/"
xmlns="http://www.w3.org/2005/Atom"
xmlns:georss="http://www.georss.org/georss">
<updated>2010-01-13T17:24:37Z</updated>
<title>USGS M5+ Earthquakes</title>
<subtitle>Real-time, worldwide earthquake list for the past 7
days</subtitle>
<link rel="self" href="/earthquakes/catalogs/7day-M5.xml"/>
<link href="http://earthquake.usgs.gov/earthquakes/"/>
<author><name>U.S. Geological Survey</name></author>
<id>http://earthquake.usgs.gov/</id>
<icon>/favicon.ico</icon>
<entry><id>urn:earthquake-usgs-gov:us:2010rkb8</id><title>M 5.3,
Tonga</title><updated>2010-01-13T16:21:24Z</updated><link
rel="alternate" type="text/html"
href="/earthquakes/recenteqsww/Quakes/us2010rkb8.php"/><summary
type="html"><![CDATA[<img
src="http://earthquake.usgs.gov/images/globes/-15_-175.jpg"
alt="15.741°S 174.695°W" align="left" hspace="20"
/><p>Wednesday, January 13, 2010 16:21:24 UTC<br>Thursday, January 14,
2010 06:21:24 AM at epicenter</p><p><strong>Depth</strong>: 10.00 km
(6.21 mi)</p>]]></summary><georss:point>-15.7409
-174.6951</georss:point><georss:elev>-10000</georss:elev><category
label="Age" term="Past day"/></entry>
</feed>
And run this command
perl -MXML::Feed -e 'my $feed = XML::Feed->parse("7day-M5.xml");
foreach my $e ($feed->entries) { print $e->link , "\n"; } '
I could not figure out if this bug lies in XML::Feed or XML::Atom. I
ran the code through the debugger but for the life of me could not tell
how it works.
Thanks for you time.
Jason