Merge pull request #2869 from tonio/xmlexport

Export useful xml functions
This commit is contained in:
Antoine Abt
2014-10-27 17:13:52 +01:00
14 changed files with 107 additions and 101 deletions

View File

@@ -142,7 +142,7 @@ ol.format.GML3.prototype.curveMemberParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'curveMember' ||
node.localName == 'curveMembers');
ol.xml.parse(this.CURVEMEMBER_PARSERS_, node, objectStack, this);
ol.xml.parseNode(this.CURVEMEMBER_PARSERS_, node, objectStack, this);
};
@@ -155,7 +155,7 @@ ol.format.GML3.prototype.surfaceMemberParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'surfaceMember' ||
node.localName == 'surfaceMembers');
ol.xml.parse(this.SURFACEMEMBER_PARSERS_,
ol.xml.parseNode(this.SURFACEMEMBER_PARSERS_,
node, objectStack, this);
};

View File

@@ -274,7 +274,7 @@ ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'pointMember' ||
node.localName == 'pointMembers');
ol.xml.parse(this.POINTMEMBER_PARSERS_,
ol.xml.parseNode(this.POINTMEMBER_PARSERS_,
node, objectStack, this);
};
@@ -289,7 +289,7 @@ ol.format.GMLBase.prototype.lineStringMemberParser_ =
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'lineStringMember' ||
node.localName == 'lineStringMembers');
ol.xml.parse(this.LINESTRINGMEMBER_PARSERS_,
ol.xml.parseNode(this.LINESTRINGMEMBER_PARSERS_,
node, objectStack, this);
};
@@ -304,7 +304,7 @@ ol.format.GMLBase.prototype.polygonMemberParser_ =
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'polygonMember' ||
node.localName == 'polygonMembers');
ol.xml.parse(this.POLYGONMEMBER_PARSERS_, node,
ol.xml.parseNode(this.POLYGONMEMBER_PARSERS_, node,
objectStack, this);
};

View File

@@ -100,7 +100,7 @@ ol.format.GPX.parseLink_ = function(node, objectStack) {
if (!goog.isNull(href)) {
goog.object.set(values, 'link', href);
}
ol.xml.parse(ol.format.GPX.LINK_PARSERS_, node, objectStack);
ol.xml.parseNode(ol.format.GPX.LINK_PARSERS_, node, objectStack);
};
@@ -164,7 +164,7 @@ ol.format.GPX.parseTrkSeg_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'trkseg');
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
ol.xml.parse(ol.format.GPX.TRKSEG_PARSERS_, node, objectStack);
ol.xml.parseNode(ol.format.GPX.TRKSEG_PARSERS_, node, objectStack);
var flatCoordinates = /** @type {Array.<number>} */
(goog.object.get(values, 'flatCoordinates'));
var ends = /** @type {Array.<number>} */ (goog.object.get(values, 'ends'));

View File

@@ -1000,7 +1000,7 @@ ol.format.KML.DataParser_ = function(node, objectStack) {
ol.format.KML.ExtendedDataParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'ExtendedData');
ol.xml.parse(ol.format.KML.EXTENDED_DATA_PARSERS_, node, objectStack);
ol.xml.parseNode(ol.format.KML.EXTENDED_DATA_PARSERS_, node, objectStack);
};
@@ -1066,7 +1066,7 @@ ol.format.KML.PlacemarkStyleMapParser_ = function(node, objectStack) {
ol.format.KML.SchemaDataParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'SchemaData');
ol.xml.parse(ol.format.KML.SCHEMA_DATA_PARSERS_, node, objectStack);
ol.xml.parseNode(ol.format.KML.SCHEMA_DATA_PARSERS_, node, objectStack);
};
@@ -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();
@@ -278,7 +278,7 @@ ol.format.WFS.OGC_FID_PARSERS_ = {
* @private
*/
ol.format.WFS.fidParser_ = function(node, objectStack) {
ol.xml.parse(ol.format.WFS.OGC_FID_PARSERS_, node, objectStack);
ol.xml.parseNode(ol.format.WFS.OGC_FID_PARSERS_, node, objectStack);
};

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

@@ -77,9 +77,12 @@ ol.xml.createElementNS =
/**
* Recursively grab all text content of child nodes into a single string.
* @param {Node} node Node.
* @param {boolean} normalizeWhitespace Normalize whitespace.
* @param {boolean} normalizeWhitespace Normalize whitespace: remove all line
* breaks.
* @return {string} All text content.
* @api
*/
ol.xml.getAllTextContent = function(node, normalizeWhitespace) {
return ol.xml.getAllTextContent_(node, normalizeWhitespace, []).join('');
@@ -88,7 +91,8 @@ ol.xml.getAllTextContent = function(node, normalizeWhitespace) {
/**
* @param {Node} node Node.
* @param {boolean} normalizeWhitespace Normalize whitespace.
* @param {boolean} normalizeWhitespace Normalize whitespace: remove all line
* breaks.
* @param {Array.<String|string>} accumulator Accumulator.
* @private
* @return {Array.<String|string>} Accumulator.
@@ -332,10 +336,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');
};
@@ -641,7 +647,7 @@ ol.xml.makeStructureNS = function(namespaceURIs, structure, opt_structureNS) {
* @param {Array.<*>} objectStack Object stack.
* @param {*=} opt_this The object to use as `this`.
*/
ol.xml.parse = function(parsersNS, node, objectStack, opt_this) {
ol.xml.parseNode = function(parsersNS, node, objectStack, opt_this) {
var n;
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
var parsers = parsersNS[n.namespaceURI];
@@ -668,7 +674,7 @@ ol.xml.parse = function(parsersNS, node, objectStack, opt_this) {
ol.xml.pushParseAndPop = function(
object, parsersNS, node, objectStack, opt_this) {
objectStack.push(object);
ol.xml.parse(parsersNS, node, objectStack, opt_this);
ol.xml.parseNode(parsersNS, node, objectStack, opt_this);
return objectStack.pop();
};

View File

@@ -1,7 +1,7 @@
goog.provide('ol.test.format.GML');
var readGeometry = function(format, text, opt_options) {
var doc = ol.xml.load(text);
var doc = ol.xml.parse(text);
// we need an intermediate node for testing purposes
var node = goog.dom.createElement(goog.dom.TagName.PRE);
node.appendChild(doc.documentElement);
@@ -131,7 +131,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(ol.geom.Point);
expect(g.getCoordinates()).to.eql([1, 2, 0]);
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('can read a point geometry with scientific notation', function() {
@@ -201,7 +201,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(ol.geom.Point);
expect(g.getCoordinates()).to.eql([1, 2, 0]);
var serialized = formatWGS84.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
});
@@ -218,7 +218,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(ol.geom.LineString);
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('can read, transform and write a linestring geometry', function() {
@@ -257,7 +257,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(ol.geom.LineString);
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
var serialized = formatWGS84.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
});
@@ -275,7 +275,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(ol.geom.LineString);
expect(g.getCoordinates()).to.eql([[-180, -90, 0], [180, 90, 0]]);
var serialized = formatWGS84.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('can read and write a point geometry with correct axis order',
@@ -289,7 +289,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(ol.geom.Point);
expect(g.getCoordinates()).to.eql([-180, -90, 0]);
var serialized = formatWGS84.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('can read and write a surface geometry with right axis order',
@@ -320,7 +320,7 @@ describe('ol.format.GML3', function() {
srsName: 'urn:x-ogc:def:crs:EPSG:4326',
surface: false});
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
});
@@ -353,7 +353,7 @@ describe('ol.format.GML3', function() {
expect(g.getCoordinates()).to.eql(
[[1, 2, 0], [3, 4, 0], [5, 6, 0], [1, 2, 0]]);
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
});
@@ -386,7 +386,7 @@ describe('ol.format.GML3', function() {
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
});
@@ -424,7 +424,7 @@ describe('ol.format.GML3', function() {
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
format = new ol.format.GML({srsName: 'CRS:84', surface: true});
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
});
@@ -446,7 +446,7 @@ describe('ol.format.GML3', function() {
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
format = new ol.format.GML({srsName: 'CRS:84', curve: true});
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
});
@@ -492,7 +492,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(ol.geom.MultiPoint);
expect(g.getCoordinates()).to.eql([[1, 2, 0], [2, 3, 0], [3, 4, 0]]);
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('can read a plural multipoint geometry', function() {
@@ -541,7 +541,7 @@ describe('ol.format.GML3', function() {
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
format = new ol.format.GML({srsName: 'CRS:84', multiCurve: false});
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('can read a plural multilinestring geometry', function() {
@@ -609,7 +609,7 @@ describe('ol.format.GML3', function() {
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
format = new ol.format.GML({srsName: 'CRS:84', multiSurface: false});
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('can read a plural multipolygon geometry', function() {
@@ -677,7 +677,7 @@ describe('ol.format.GML3', function() {
expect(g.getCoordinates()).to.eql(
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('can read and write a singular multicurve-curve geometry', function() {
@@ -709,7 +709,7 @@ describe('ol.format.GML3', function() {
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
format = new ol.format.GML({srsName: 'CRS:84', curve: true});
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
});
@@ -757,7 +757,7 @@ describe('ol.format.GML3', function() {
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('can read a plural multisurface geometry', function() {
@@ -852,7 +852,7 @@ describe('ol.format.GML3', function() {
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
format = new ol.format.GML({srsName: 'CRS:84', surface: true});
var serialized = format.writeGeometry(g);
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
});
@@ -979,7 +979,7 @@ describe('ol.format.GML3', function() {
it('writes back features as GML', function() {
this.timeout(4000);
var serialized = gmlFormat.writeFeatures(features);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});

View File

@@ -56,7 +56,7 @@ describe('ol.format.GPX', function() {
expect(f.get('number')).to.be(1);
expect(f.get('type')).to.be('Type');
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can read and write a rte with multiple rtepts', function() {
@@ -76,7 +76,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([[2, 1, 0, 0], [4, 3, 0, 0]]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can transform, read and write a rte', function() {
@@ -104,7 +104,7 @@ describe('ol.format.GPX', function() {
var serialized = format.writeFeatures(fs, {
featureProjection: 'EPSG:3857'
});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});
@@ -156,7 +156,7 @@ describe('ol.format.GPX', function() {
expect(f.get('number')).to.be(1);
expect(f.get('type')).to.be('Type');
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can read and write a trk with an empty trkseg', function() {
@@ -175,7 +175,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([[]]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can read/write a trk with a trkseg with multiple trkpts', function() {
@@ -205,7 +205,7 @@ describe('ol.format.GPX', function() {
]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can tranform, read and write a trk with a trkseg', function() {
@@ -241,7 +241,7 @@ describe('ol.format.GPX', function() {
var serialized = format.writeFeatures(fs, {
featureProjection: 'EPSG:3857'
});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can read and write a trk with multiple trksegs', function() {
@@ -282,7 +282,7 @@ describe('ol.format.GPX', function() {
]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});
@@ -303,7 +303,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([2, 1, 0, 0]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can transform, read and write a wpt', function() {
@@ -326,7 +326,7 @@ describe('ol.format.GPX', function() {
var serialized = format.writeFeatures(fs, {
featureProjection: 'EPSG:3857'
});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can read and write a wpt with ele', function() {
@@ -345,7 +345,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([2, 1, 3, 0]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can read and write a wpt with time', function() {
@@ -364,7 +364,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([2, 1, 0, 1263115752]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can read and write a wpt with ele and time', function() {
@@ -384,7 +384,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([2, 1, 3, 1263115752]);
expect(g.getLayout()).to.be(ol.geom.GeometryLayout.XYZM);
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('can read and write various wpt attributes', function() {
@@ -434,7 +434,7 @@ describe('ol.format.GPX', function() {
expect(f.get('ageofdgpsdata')).to.be(9);
expect(f.get('dgpsid')).to.be(10);
var serialized = format.writeFeatures(fs);
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});

View File

@@ -47,7 +47,7 @@ describe('ol.format.KML', function() {
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark/>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write a Feature\'s id', function() {
@@ -63,7 +63,7 @@ describe('ol.format.KML', function() {
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark id="foo"/>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
});
@@ -94,7 +94,7 @@ describe('ol.format.KML', function() {
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark/>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can read Point geometries', function() {
@@ -206,7 +206,7 @@ describe('ol.format.KML', function() {
' </Point>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYZ Point geometries', function() {
@@ -226,7 +226,7 @@ describe('ol.format.KML', function() {
' </Point>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can transform and write XYZ Point geometries', function() {
@@ -258,7 +258,7 @@ describe('ol.format.KML', function() {
' </Point>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
ol.proj.removeTransform(
ol.proj.get('EPSG:4326'), ol.proj.get('double'));
@@ -283,7 +283,7 @@ describe('ol.format.KML', function() {
' </Point>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYZM Point geometries', function() {
@@ -303,7 +303,7 @@ describe('ol.format.KML', function() {
' </Point>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can read LineString geometries', function() {
@@ -341,7 +341,7 @@ describe('ol.format.KML', function() {
' </LineString>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYZ LineString geometries', function() {
@@ -362,7 +362,7 @@ describe('ol.format.KML', function() {
' </LineString>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYM LineString geometries', function() {
@@ -383,7 +383,7 @@ describe('ol.format.KML', function() {
' </LineString>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYZM LineString geometries', function() {
@@ -404,7 +404,7 @@ describe('ol.format.KML', function() {
' </LineString>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can read LinearRing geometries', function() {
@@ -443,7 +443,7 @@ describe('ol.format.KML', function() {
' </LinearRing>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYZ LinearRing geometries', function() {
@@ -464,7 +464,7 @@ describe('ol.format.KML', function() {
' </LinearRing>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYM LinearRing geometries', function() {
@@ -485,7 +485,7 @@ describe('ol.format.KML', function() {
' </LinearRing>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYZM LinearRing geometries', function() {
@@ -506,7 +506,7 @@ describe('ol.format.KML', function() {
' </LinearRing>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can read Polygon geometries', function() {
@@ -554,7 +554,7 @@ describe('ol.format.KML', function() {
' </Polygon>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYZ Polygon geometries', function() {
@@ -581,7 +581,7 @@ describe('ol.format.KML', function() {
' </Polygon>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYM Polygon geometries', function() {
@@ -608,7 +608,7 @@ describe('ol.format.KML', function() {
' </Polygon>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write XYZM Polygon geometries', function() {
@@ -634,7 +634,7 @@ describe('ol.format.KML', function() {
' </Polygon>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can read complex Polygon geometries', function() {
@@ -706,7 +706,7 @@ describe('ol.format.KML', function() {
' </Polygon>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can read MultiPoint geometries', function() {
@@ -755,7 +755,7 @@ describe('ol.format.KML', function() {
' </MultiGeometry>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can read MultiLineString geometries', function() {
@@ -805,7 +805,7 @@ describe('ol.format.KML', function() {
' </MultiGeometry>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can read MultiPolygon geometries', function() {
@@ -873,7 +873,7 @@ describe('ol.format.KML', function() {
' </MultiGeometry>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can read empty GeometryCollection geometries', function() {
@@ -1140,7 +1140,7 @@ describe('ol.format.KML', function() {
' <description>My description</description>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write Feature\'s boolean attributes', function() {
@@ -1160,7 +1160,7 @@ describe('ol.format.KML', function() {
' <visibility>0</visibility>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
});
@@ -1608,7 +1608,7 @@ describe('ol.format.KML', function() {
' </Style>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write an feature\'s text style', function() {
@@ -1640,7 +1640,7 @@ describe('ol.format.KML', function() {
' </Style>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write an feature\'s stroke style', function() {
@@ -1668,7 +1668,7 @@ describe('ol.format.KML', function() {
' </Style>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write an feature\'s fill style', function() {
@@ -1694,7 +1694,7 @@ describe('ol.format.KML', function() {
' </Style>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
});
@@ -2210,7 +2210,7 @@ describe('ol.format.KML', function() {
' </Placemark>' +
' </Document>' +
'</kml>';
expect(node).to.xmleql(ol.xml.load(text));
expect(node).to.xmleql(ol.xml.parse(text));
});
});

View File

@@ -7,7 +7,7 @@ describe('ol.format.OWS 1.1', function() {
var parser = new ol.format.OWS();
it('should read ServiceProvider tag properly', function() {
var doc = ol.xml.load(
var doc = ol.xml.parse(
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
'<ows:ServiceProvider>' +
@@ -56,7 +56,7 @@ describe('ol.format.OWS 1.1', function() {
});
it('should read ServiceIdentification tag properly', function() {
var doc = ol.xml.load(
var doc = ol.xml.parse(
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
'<ows:ServiceIdentification>' +
@@ -86,7 +86,7 @@ describe('ol.format.OWS 1.1', function() {
});
it('should read OperationsMetadata tag properly', function() {
var doc = ol.xml.load(
var doc = ol.xml.parse(
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
'<ows:OperationsMetadata>' +

View File

@@ -179,7 +179,7 @@ describe('ol.format.WFS', function() {
srsName: 'urn:ogc:def:crs:EPSG::4326',
propertyNames: ['STATE_NAME', 'STATE_FIPS', 'STATE_ABBR']
});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('creates paging headers', function() {
@@ -204,7 +204,7 @@ describe('ol.format.WFS', function() {
featurePrefix: 'topp',
featureTypes: ['states']
});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
it('creates a BBOX filter', function() {
@@ -231,7 +231,7 @@ describe('ol.format.WFS', function() {
geometryName: 'the_geom',
bbox: [1, 2, 3, 4]
});
expect(serialized.firstElementChild).to.xmleql(ol.xml.load(text));
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
});
@@ -247,7 +247,7 @@ describe('ol.format.WFS', function() {
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>';
var serialized = new ol.format.WFS().writeTransaction(null, null, null,
{handle: 'handle_t'});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});
@@ -278,7 +278,7 @@ describe('ol.format.WFS', function() {
featurePrefix: 'feature',
gmlOptions: {multiCurve: true, srsName: 'EPSG:900913'}
});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});
@@ -309,7 +309,7 @@ describe('ol.format.WFS', function() {
featurePrefix: 'foo',
gmlOptions: {srsName: 'EPSG:900913'}
});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});
@@ -350,7 +350,7 @@ describe('ol.format.WFS', function() {
featureType: 'states',
featurePrefix: 'topp'
});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});
@@ -377,7 +377,7 @@ describe('ol.format.WFS', function() {
value: 'Another native line goes here'
}]
});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});
@@ -397,7 +397,7 @@ describe('ol.format.WFS', function() {
featureTypes: ['states', 'cities'],
featurePrefix: 'topp'
});
expect(serialized).to.xmleql(ol.xml.load(text));
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});