From f7d58dc36ca9ff6ecafcd4f17e5a20547b46d010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Junod?= Date: Mon, 28 Feb 2011 08:10:10 +0000 Subject: [PATCH] GeoRSS is not properly parsed if multiple children. r=crschmidt (closes #2780) git-svn-id: http://svn.openlayers.org/trunk/openlayers@11574 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Format/GeoRSS.js | 2 +- tests/Format/GeoRSS.html | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/GeoRSS.js b/lib/OpenLayers/Format/GeoRSS.js index 8f15415724..406cf42dec 100644 --- a/lib/OpenLayers/Format/GeoRSS.js +++ b/lib/OpenLayers/Format/GeoRSS.js @@ -253,7 +253,7 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, { var eles = this.getElementsByTagNameNS(node, nsuri, name); if(eles && eles[0] && eles[0].firstChild && eles[0].firstChild.nodeValue) { - value = eles[0].firstChild.nodeValue; + value = OpenLayers.Format.XML.prototype.getChildValue(eles[0]); } else { value = (def == undefined) ? "" : def; } diff --git a/tests/Format/GeoRSS.html b/tests/Format/GeoRSS.html index 95d3ba99d9..5cea1ae627 100644 --- a/tests/Format/GeoRSS.html +++ b/tests/Format/GeoRSS.html @@ -73,6 +73,15 @@ t.xml_eq(out, expected_result, "Output gave expected value"); } } + + function test_leading_space(t) { + t.plan(2); + + var parser = new OpenLayers.Format.GeoRSS(); + var items = parser.read(' '); + t.eq(items.length, 1, "item created"); + t.eq(items[0].attributes.description, " foo", "description value is ok"); + } var shell_start = '\n scribble\n http://featureserver.org/featureserver.cgi/scribble?format=atom\n FeatureServer\n'; var shell_end = '';