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:
@@ -253,7 +253,7 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
var eles = this.getElementsByTagNameNS(node, nsuri, name);
|
var eles = this.getElementsByTagNameNS(node, nsuri, name);
|
||||||
if(eles && eles[0] && eles[0].firstChild
|
if(eles && eles[0] && eles[0].firstChild
|
||||||
&& eles[0].firstChild.nodeValue) {
|
&& eles[0].firstChild.nodeValue) {
|
||||||
value = eles[0].firstChild.nodeValue;
|
value = OpenLayers.Format.XML.prototype.getChildValue(eles[0]);
|
||||||
} else {
|
} else {
|
||||||
value = (def == undefined) ? "" : def;
|
value = (def == undefined) ? "" : def;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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_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>';
|
var shell_end = '</feed>';
|
||||||
var input = ['<entry><id>http://featureserver.org/featureserver.cgi/scribble/562.atom</id><link href="http://featureserver.org/featureserver.cgi/scribble/562.atom"/><title>Feature 2</title><content type="html"><b>strokeColor</b>: red<br /><b>title</b>: Feature 2<br /><b>author</b>: Your Name Here</content><georss:polygon>-5.9765625 -131.484375 -58.0078125 -112.5 -50.2734375 -32.34375 52.3828125 -114.609375 -35.5078125 -167.34375 -57.3046875 -146.953125 -34.1015625 -139.921875 -5.9765625 -131.484375</georss:polygon></entry>',
|
var input = ['<entry><id>http://featureserver.org/featureserver.cgi/scribble/562.atom</id><link href="http://featureserver.org/featureserver.cgi/scribble/562.atom"/><title>Feature 2</title><content type="html"><b>strokeColor</b>: red<br /><b>title</b>: Feature 2<br /><b>author</b>: Your Name Here</content><georss:polygon>-5.9765625 -131.484375 -58.0078125 -112.5 -50.2734375 -32.34375 52.3828125 -114.609375 -35.5078125 -167.34375 -57.3046875 -146.953125 -34.1015625 -139.921875 -5.9765625 -131.484375</georss:polygon></entry>',
|
||||||
|
|||||||
Reference in New Issue
Block a user