Deprecated XML.js method.

This commit is contained in:
Tim Schaub
2011-11-08 22:07:29 -07:00
parent b7c826e796
commit 5f2a6d410b
3 changed files with 53 additions and 45 deletions
+42
View File
@@ -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 <getChildValue> 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;
}
});