Deprecated XML.js method.
This commit is contained in:
@@ -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<len; i+=2) {
|
||||
@@ -138,7 +138,7 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
}
|
||||
geometry = new OpenLayers.Geometry.LineString(components);
|
||||
} else if (polygon.length > 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<len; i+=2) {
|
||||
@@ -193,17 +193,17 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
var geometry = this.createGeometryFromItem(item);
|
||||
|
||||
/* Provide defaults for title and description */
|
||||
var title = this.getChildValue(item, "*", "title", this.featureTitle);
|
||||
var title = this._getChildValue(item, "*", "title", this.featureTitle);
|
||||
|
||||
/* First try RSS descriptions, then Atom summaries */
|
||||
var description = this.getChildValue(
|
||||
var description = this._getChildValue(
|
||||
item, "*", "description",
|
||||
this.getChildValue(item, "*", "content",
|
||||
this.getChildValue(item, "*", "summary", this.featureDescription)));
|
||||
this._getChildValue(item, "*", "content",
|
||||
this._getChildValue(item, "*", "summary", this.featureDescription)));
|
||||
|
||||
/* If no link URL is found in the first child node, try the
|
||||
href attribute */
|
||||
var link = this.getChildValue(item, "*", "link");
|
||||
var link = this._getChildValue(item, "*", "link");
|
||||
if(!link) {
|
||||
try {
|
||||
link = this.getElementsByTagNameNS(item, "*", "link")[0].getAttribute("href");
|
||||
@@ -212,7 +212,7 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
}
|
||||
}
|
||||
|
||||
var id = this.getChildValue(item, "*", "id", null);
|
||||
var id = this._getChildValue(item, "*", "id", null);
|
||||
|
||||
var data = {
|
||||
"title": title,
|
||||
@@ -225,7 +225,7 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getChildValue
|
||||
* Method: _getChildValue
|
||||
*
|
||||
* Parameters:
|
||||
* node - {DOMElement}
|
||||
@@ -237,12 +237,12 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
* {String} The value of the first child with the given tag name. Returns
|
||||
* default value or empty string if none found.
|
||||
*/
|
||||
getChildValue: function(node, nsuri, name, def) {
|
||||
_getChildValue: function(node, nsuri, name, def) {
|
||||
var value;
|
||||
var eles = this.getElementsByTagNameNS(node, nsuri, name);
|
||||
if(eles && eles[0] && eles[0].firstChild
|
||||
&& eles[0].firstChild.nodeValue) {
|
||||
value = OpenLayers.Format.XML.prototype.getChildValue(eles[0]);
|
||||
value = this.getChildValue(eles[0]);
|
||||
} else {
|
||||
value = (def == undefined) ? "" : def;
|
||||
}
|
||||
|
||||
@@ -379,40 +379,6 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
|
||||
return value;
|
||||
},
|
||||
|
||||
/**
|
||||
* 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;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: isSimpleContent
|
||||
* Test if the given node has only simple content (i.e. no child element
|
||||
|
||||
Reference in New Issue
Block a user