Move namespaces into constants
This commit is contained in:
@@ -73,6 +73,20 @@ ol.format.WFS.FEATURE_PREFIX = 'feature';
|
|||||||
ol.format.WFS.XMLNS = 'http://www.w3.org/2000/xmlns/';
|
ol.format.WFS.XMLNS = 'http://www.w3.org/2000/xmlns/';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
ol.format.WFS.OGCNS = 'http://www.opengis.net/ogc';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
ol.format.WFS.WFSNS = 'http://www.opengis.net/wfs';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@@ -370,8 +384,8 @@ ol.format.WFS.writeFeature_ = function(node, feature, objectStack) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.WFS.writeOgcFidFilter_ = function(node, fid, objectStack) {
|
ol.format.WFS.writeOgcFidFilter_ = function(node, fid, objectStack) {
|
||||||
var filter = ol.xml.createElementNS('http://www.opengis.net/ogc', 'Filter');
|
var filter = ol.xml.createElementNS(ol.format.WFS.OGCNS, 'Filter');
|
||||||
var child = ol.xml.createElementNS('http://www.opengis.net/ogc', 'FeatureId');
|
var child = ol.xml.createElementNS(ol.format.WFS.OGCNS, 'FeatureId');
|
||||||
filter.appendChild(child);
|
filter.appendChild(child);
|
||||||
child.setAttribute('fid', fid);
|
child.setAttribute('fid', fid);
|
||||||
node.appendChild(filter);
|
node.appendChild(filter);
|
||||||
@@ -446,11 +460,11 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.WFS.writeProperty_ = function(node, pair, objectStack) {
|
ol.format.WFS.writeProperty_ = function(node, pair, objectStack) {
|
||||||
var name = ol.xml.createElementNS('http://www.opengis.net/wfs', 'Name');
|
var name = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Name');
|
||||||
node.appendChild(name);
|
node.appendChild(name);
|
||||||
ol.format.XSD.writeStringTextNode(name, pair.name);
|
ol.format.XSD.writeStringTextNode(name, pair.name);
|
||||||
if (pair.value !== undefined && pair.value !== null) {
|
if (pair.value !== undefined && pair.value !== null) {
|
||||||
var value = ol.xml.createElementNS('http://www.opengis.net/wfs', 'Value');
|
var value = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Value');
|
||||||
node.appendChild(value);
|
node.appendChild(value);
|
||||||
if (pair.value instanceof ol.geom.Geometry) {
|
if (pair.value instanceof ol.geom.Geometry) {
|
||||||
ol.format.GML3.prototype.writeGeometryElement(value,
|
ol.format.GML3.prototype.writeGeometryElement(value,
|
||||||
@@ -526,7 +540,7 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
|
|||||||
objectStack);
|
objectStack);
|
||||||
var filter = context['filter'];
|
var filter = context['filter'];
|
||||||
if (filter) {
|
if (filter) {
|
||||||
var child = ol.xml.createElementNS('http://www.opengis.net/ogc', 'Filter');
|
var child = ol.xml.createElementNS(ol.format.WFS.OGCNS, 'Filter');
|
||||||
node.appendChild(child);
|
node.appendChild(child);
|
||||||
ol.format.WFS.writeFilterCondition_(child, filter, objectStack);
|
ol.format.WFS.writeFilterCondition_(child, filter, objectStack);
|
||||||
}
|
}
|
||||||
@@ -668,11 +682,11 @@ ol.format.WFS.writeIsNullFilter_ = function(node, filter, objectStack) {
|
|||||||
ol.format.WFS.writeIsBetweenFilter_ = function(node, filter, objectStack) {
|
ol.format.WFS.writeIsBetweenFilter_ = function(node, filter, objectStack) {
|
||||||
ol.format.WFS.writeOgcPropertyName_(node, filter.propertyName);
|
ol.format.WFS.writeOgcPropertyName_(node, filter.propertyName);
|
||||||
|
|
||||||
var lowerBoundary = ol.xml.createElementNS('http://www.opengis.net/ogc', 'LowerBoundary');
|
var lowerBoundary = ol.xml.createElementNS(ol.format.WFS.OGCNS, 'LowerBoundary');
|
||||||
node.appendChild(lowerBoundary);
|
node.appendChild(lowerBoundary);
|
||||||
ol.format.WFS.writeOgcLiteral_(lowerBoundary, '' + filter.lowerBoundary);
|
ol.format.WFS.writeOgcLiteral_(lowerBoundary, '' + filter.lowerBoundary);
|
||||||
|
|
||||||
var upperBoundary = ol.xml.createElementNS('http://www.opengis.net/ogc', 'UpperBoundary');
|
var upperBoundary = ol.xml.createElementNS(ol.format.WFS.OGCNS, 'UpperBoundary');
|
||||||
node.appendChild(upperBoundary);
|
node.appendChild(upperBoundary);
|
||||||
ol.format.WFS.writeOgcLiteral_(upperBoundary, '' + filter.upperBoundary);
|
ol.format.WFS.writeOgcLiteral_(upperBoundary, '' + filter.upperBoundary);
|
||||||
};
|
};
|
||||||
@@ -703,7 +717,7 @@ ol.format.WFS.writeIsLikeFilter_ = function(node, filter, objectStack) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.WFS.writeOgcExpression_ = function(tagName, node, value) {
|
ol.format.WFS.writeOgcExpression_ = function(tagName, node, value) {
|
||||||
var property = ol.xml.createElementNS('http://www.opengis.net/ogc', tagName);
|
var property = ol.xml.createElementNS(ol.format.WFS.OGCNS, tagName);
|
||||||
ol.format.XSD.writeStringTextNode(property, value);
|
ol.format.XSD.writeStringTextNode(property, value);
|
||||||
node.appendChild(property);
|
node.appendChild(property);
|
||||||
};
|
};
|
||||||
@@ -782,8 +796,7 @@ ol.format.WFS.writeGetFeature_ = function(node, featureTypes, objectStack) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.format.WFS.prototype.writeGetFeature = function(options) {
|
ol.format.WFS.prototype.writeGetFeature = function(options) {
|
||||||
var node = ol.xml.createElementNS('http://www.opengis.net/wfs',
|
var node = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'GetFeature');
|
||||||
'GetFeature');
|
|
||||||
node.setAttribute('service', 'WFS');
|
node.setAttribute('service', 'WFS');
|
||||||
node.setAttribute('version', '1.1.0');
|
node.setAttribute('version', '1.1.0');
|
||||||
var filter;
|
var filter;
|
||||||
@@ -852,8 +865,7 @@ ol.format.WFS.prototype.writeGetFeature = function(options) {
|
|||||||
ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||||
options) {
|
options) {
|
||||||
var objectStack = [];
|
var objectStack = [];
|
||||||
var node = ol.xml.createElementNS('http://www.opengis.net/wfs',
|
var node = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Transaction');
|
||||||
'Transaction');
|
|
||||||
node.setAttribute('service', 'WFS');
|
node.setAttribute('service', 'WFS');
|
||||||
node.setAttribute('version', '1.1.0');
|
node.setAttribute('version', '1.1.0');
|
||||||
var baseObj;
|
var baseObj;
|
||||||
|
|||||||
Reference in New Issue
Block a user