diff --git a/lib/OpenLayers/Format/GeoRSS.js b/lib/OpenLayers/Format/GeoRSS.js index f81c727a50..79c6356280 100644 --- a/lib/OpenLayers/Format/GeoRSS.js +++ b/lib/OpenLayers/Format/GeoRSS.js @@ -129,7 +129,7 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, { var geometry = new OpenLayers.Geometry.Point(location[1], location[0]); } else if (line.length > 0) { - var coords = OpenLayers.String.trim(this.concatChildValues(line[0])).split(/\s+/); + var coords = OpenLayers.String.trim(this.getChildValue(line[0])).split(/\s+/); var components = []; var point; for (var i=0, len=coords.length; i 0) { - var coords = OpenLayers.String.trim(this.concatChildValues(polygon[0])).split(/\s+/); + var coords = OpenLayers.String.trim(this.getChildValue(polygon[0])).split(/\s+/); var components = []; var point; for (var i=0, len=coords.length; i instead. - * - * Concatenate the value of all child nodes if any exist, or return an - * optional default string. Returns an empty string if no children - * exist and no default value is supplied. Not optimized for large - * numbers of child nodes. - * - * Parameters: - * node - {DOMElement} The element used to look for child values. - * def - {String} Optional string to return in the event that no - * child exist. - * - * Returns: - * {String} The concatenated value of all child nodes of the given node. - */ - concatChildValues: function(node, def) { - var value = ""; - var child = node.firstChild; - var childValue; - while(child) { - childValue = child.nodeValue; - if(childValue) { - value += childValue; - } - child = child.nextSibling; - } - if(value == "" && def != undefined) { - value = def; - } - return value; - }, - /** * APIMethod: isSimpleContent * Test if the given node has only simple content (i.e. no child element diff --git a/lib/deprecated.js b/lib/deprecated.js index 03b74f3ef8..bcc4d270bb 100644 --- a/lib/deprecated.js +++ b/lib/deprecated.js @@ -1702,3 +1702,45 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class( OpenLayers.Control.MouseToolbar.X = 6; OpenLayers.Control.MouseToolbar.Y = 300; +/** + * Class: OpenLayers.Format.XML + */ +OpenLayers.Util.extend(OpenLayers.Format.XML.prototype, { + + /** + * APIMethod: concatChildValues + * *Deprecated*. Use instead. + * + * Concatenate the value of all child nodes if any exist, or return an + * optional default string. Returns an empty string if no children + * exist and no default value is supplied. Not optimized for large + * numbers of child nodes. + * + * Parameters: + * node - {DOMElement} The element used to look for child values. + * def - {String} Optional string to return in the event that no + * child exist. + * + * Returns: + * {String} The concatenated value of all child nodes of the given node. + */ + concatChildValues: function(node, def) { + var value = ""; + var child = node.firstChild; + var childValue; + while(child) { + childValue = child.nodeValue; + if(childValue) { + value += childValue; + } + child = child.nextSibling; + } + if(value == "" && def != undefined) { + value = def; + } + return value; + } + + +}); +