diff --git a/lib/OpenLayers/Layer/GeoRSS.js b/lib/OpenLayers/Layer/GeoRSS.js
index 9de4b37268..76e827218c 100644
--- a/lib/OpenLayers/Layer/GeoRSS.js
+++ b/lib/OpenLayers/Layer/GeoRSS.js
@@ -130,7 +130,18 @@ OpenLayers.Layer.GeoRSS.prototype =
}
catch (e) { description="No description."; }
- try { var link = OpenLayers.Util.getNodes(itemlist[i], "link")[0].firstChild.nodeValue; } catch (e) { }
+ /* If no link URL is found in the first child node, try the
+ href attribute */
+ try {
+ var link = OpenLayers.Util.getNodes(itemlist[i], "link")[0].firstChild.nodeValue;
+ }
+ catch (e) {
+ try {
+ var link = OpenLayers.Util.getNodes(itemlist[i], "link")[0].getAttribute("href");
+ }
+ catch (e) {}
+ }
+
data.icon = OpenLayers.Marker.defaultIcon();
data.popupSize = new OpenLayers.Size(250, 120);
if ((title != null) && (description != null)) {
diff --git a/tests/atom-1.0.xml b/tests/atom-1.0.xml
new file mode 100644
index 0000000000..f0d5d6fce2
--- /dev/null
+++ b/tests/atom-1.0.xml
@@ -0,0 +1,34 @@
+
+
+
+ tumulus
+
+
+
+ http://pleiades.stoa.org/places/tumulus
+
+
+ Unnamed Tumulus
+
+ http://pleiades.stoa.org/places/638896
+
+ An ancient tumulus, attested during the Classical period (modern location: Karaburun). Its ancient name is not known.
+ 36.7702 29.9805
+
+
+ Unnamed Tumulus
+
+ http://pleiades.stoa.org/places/638924
+
+ An ancient tumulus, attested during the Classical period (modern location: Kızılbel). Its ancient name is not known.
+ 36.7263 29.8619
+
+
+
+
diff --git a/tests/test_Layer_GeoRSS.html b/tests/test_Layer_GeoRSS.html
index bd317dfc6f..8f88722a82 100644
--- a/tests/test_Layer_GeoRSS.html
+++ b/tests/test_Layer_GeoRSS.html
@@ -18,6 +18,22 @@
t.eq( layer.name, "Crschmidt's Places At Platial", "Layer name is correct." );
} );
}
+
+ function test_01_Layer_GeoRSS_AtomParsing (t) {
+ t.plan( 6 );
+ layer = new OpenLayers.Layer.GeoRSS('Test Layer', "./atom-1.0.xml" );
+ t.ok( layer instanceof OpenLayers.Layer.GeoRSS, "new OpenLayers.Layer.GeoRSS returns object" );
+ t.eq( layer.location, "./atom-1.0.xml", "layer.location is correct" );
+ var markers;
+ t.delay_call( 1, function() {
+ t.eq( layer.markers.length, 2, "marker length is correct" );
+ var ll = new OpenLayers.LonLat(29.9805, 36.7702);
+ t.ok( layer.markers[0].lonlat.equals(ll), "lonlat on first marker is correct" );
+ t.like( layer.features[0].data['popupContentHTML'], 'Unnamed Tumulus', "Link is correct.");
+ t.eq( layer.name, "tumulus", "Layer name is correct." );
+ } );
+ }
+
function test_02_Layer_GeoRSS_draw (t) {
// t.plan(5);
t.plan( 2 );