Rename ol.xml.load to ol.xml.parse

This commit is contained in:
Antoine Abt
2014-10-27 11:00:09 +01:00
parent 757b6a214c
commit 88d1258e83
11 changed files with 88 additions and 87 deletions

View File

@@ -1655,7 +1655,7 @@ ol.format.KML.prototype.readName = function(source) {
} else if (ol.xml.isNode(source)) {
return this.readNameFromNode(/** @type {Node} */ (source));
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readNameFromDocument(doc);
} else {
goog.asserts.fail();

View File

@@ -149,7 +149,7 @@ ol.format.WFS.prototype.readTransactionResponse = function(source) {
} else if (ol.xml.isNode(source)) {
return this.readTransactionResponseFromNode(/** @type {Node} */ (source));
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readTransactionResponseFromDocument(doc);
} else {
goog.asserts.fail();
@@ -172,7 +172,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadata = function(source) {
return this.readFeatureCollectionMetadataFromNode(
/** @type {Node} */ (source));
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readFeatureCollectionMetadataFromDocument(doc);
} else {
goog.asserts.fail();

View File

@@ -43,7 +43,7 @@ ol.format.XMLFeature.prototype.readFeature = function(source, opt_options) {
} else if (ol.xml.isNode(source)) {
return this.readFeatureFromNode(/** @type {Node} */ (source), opt_options);
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readFeatureFromDocument(doc, opt_options);
} else {
goog.asserts.fail();
@@ -86,7 +86,7 @@ ol.format.XMLFeature.prototype.readFeatures = function(source, opt_options) {
} else if (ol.xml.isNode(source)) {
return this.readFeaturesFromNode(/** @type {Node} */ (source), opt_options);
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readFeaturesFromDocument(doc, opt_options);
} else {
goog.asserts.fail();
@@ -134,7 +134,7 @@ ol.format.XMLFeature.prototype.readGeometry = function(source, opt_options) {
} else if (ol.xml.isNode(source)) {
return this.readGeometryFromNode(/** @type {Node} */ (source), opt_options);
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readGeometryFromDocument(doc, opt_options);
} else {
goog.asserts.fail();
@@ -170,7 +170,7 @@ ol.format.XMLFeature.prototype.readProjection = function(source) {
} else if (ol.xml.isNode(source)) {
return this.readProjectionFromNode(/** @type {Node} */ (source));
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readProjectionFromDocument(doc);
} else {
goog.asserts.fail();

View File

@@ -25,7 +25,7 @@ ol.format.XML.prototype.read = function(source) {
} else if (ol.xml.isNode(source)) {
return this.readFromNode(/** @type {Node} */ (source));
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readFromDocument(doc);
} else {
goog.asserts.fail();

View File

@@ -91,7 +91,7 @@ ol.source.FormatVector.prototype.loadFeaturesFromURL =
source = xhrIo.getResponseXml();
}
if (!goog.isDefAndNotNull(source)) {
source = ol.xml.load(xhrIo.getResponseText());
source = ol.xml.parse(xhrIo.getResponseText());
}
} else {
goog.asserts.fail();

View File

@@ -333,11 +333,12 @@ ol.xml.setAttributeNS =
/**
* Parse an XML string to a XML Document
* @param {string} xml XML.
* @return {Document} Document.
* @api
*/
ol.xml.load = function(xml) {
ol.xml.parse = function(xml) {
return new DOMParser().parseFromString(xml, 'application/xml');
};