GeoRSS <description> 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
This commit is contained in:
Frédéric Junod
2011-02-28 08:10:10 +00:00
parent 8beb04d2ca
commit f7d58dc36c
2 changed files with 10 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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('<rss version="2.0" xmlns:georss="http://www.georss.org/georss"><item><description> <![CDATA[foo]]></description></item></rss>');
t.eq(items.length, 1, "item created");
t.eq(items[0].attributes.description, " foo", "description value is ok");
}
var shell_start = '<feed xmlns="http://www.w3.org/2005/Atom" \n xmlns:georss="http://www.georss.org/georss">\n <title>scribble</title>\n <id>http://featureserver.org/featureserver.cgi/scribble?format=atom</id>\n <author><name>FeatureServer</name></author>\n';
var shell_end = '</feed>';