diff --git a/src/ol/format/gml/gml2format.js b/src/ol/format/gml/gml2format.js
index 4faea336ce..2dd3cfe3e7 100644
--- a/src/ol/format/gml/gml2format.js
+++ b/src/ol/format/gml/gml2format.js
@@ -43,8 +43,8 @@ goog.inherits(ol.format.GML2, ol.format.GMLBase);
* @type {string}
* @private
*/
-ol.format.GML2.schemaLocation_ = 'http://www.opengis.net/gml ' +
- 'http://schemas.opengis.net/gml/2.1.2/feature.xsd';
+ol.format.GML2.schemaLocation_ = ol.format.GMLBase.GMLNS +
+ ' http://schemas.opengis.net/gml/2.1.2/feature.xsd';
/**
diff --git a/src/ol/format/gml/gml3format.js b/src/ol/format/gml/gml3format.js
index ed9c0bba6f..e04ae9374b 100644
--- a/src/ol/format/gml/gml3format.js
+++ b/src/ol/format/gml/gml3format.js
@@ -84,8 +84,8 @@ goog.inherits(ol.format.GML3, ol.format.GMLBase);
* @type {string}
* @private
*/
-ol.format.GML3.schemaLocation_ = 'http://www.opengis.net/gml ' +
- 'http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/' +
+ol.format.GML3.schemaLocation_ = ol.format.GMLBase.GMLNS +
+ ' http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/' +
'1.0.0/gmlsf.xsd';
diff --git a/src/ol/format/gml/gmlbaseformat.js b/src/ol/format/gml/gmlbaseformat.js
index 96111d0980..47090c868d 100644
--- a/src/ol/format/gml/gmlbaseformat.js
+++ b/src/ol/format/gml/gmlbaseformat.js
@@ -73,13 +73,19 @@ ol.format.GMLBase = function(opt_options) {
goog.inherits(ol.format.GMLBase, ol.format.XMLFeature);
+/**
+ * @const
+ * @type {string}
+ */
+ol.format.GMLBase.GMLNS = 'http://www.opengis.net/gml';
+
+
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Array.
} Features.
- * @private
*/
-ol.format.GMLBase.prototype.readFeatures_ = function(node, objectStack) {
+ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
var localName = ol.xml.getLocalName(node);
var features;
@@ -117,10 +123,10 @@ ol.format.GMLBase.prototype.readFeatures_ = function(node, objectStack) {
*/
ol.format.GMLBase.prototype.FEATURE_COLLECTION_PARSERS = Object({
'http://www.opengis.net/gml': {
- 'featureMember': ol.xml.makeArrayPusher(
- ol.format.GMLBase.prototype.readFeatures_),
+ 'featureMember': ol.xml.makeReplacer(
+ ol.format.GMLBase.prototype.readFeaturesInternal),
'featureMembers': ol.xml.makeReplacer(
- ol.format.GMLBase.prototype.readFeatures_)
+ ol.format.GMLBase.prototype.readFeaturesInternal)
}
});
@@ -153,7 +159,7 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
var n;
var fid = node.getAttribute('fid') ||
- ol.xml.getAttributeNS(node, 'http://www.opengis.net/gml', 'id');
+ ol.xml.getAttributeNS(node, ol.format.GMLBase.GMLNS, 'id');
var values = {}, geometryName;
for (n = node.firstElementChild; !goog.isNull(n);
n = n.nextElementSibling) {
@@ -549,7 +555,7 @@ ol.format.GMLBase.prototype.readFeaturesFromNode =
if (goog.isDef(opt_options)) {
goog.object.extend(options, this.getReadOptions(node, opt_options));
}
- return this.readFeatures_(node, [options]);
+ return this.readFeaturesInternal(node, [options]);
};
diff --git a/src/ol/format/wfsformat.js b/src/ol/format/wfsformat.js
index 3f09348a5b..540d139506 100644
--- a/src/ol/format/wfsformat.js
+++ b/src/ol/format/wfsformat.js
@@ -125,6 +125,9 @@ ol.format.WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
goog.object.extend(context, this.getReadOptions(node,
goog.isDef(opt_options) ? opt_options : {}));
var objectStack = [context];
+ this.gmlFormat_.FEATURE_COLLECTION_PARSERS[ol.format.GMLBase.GMLNS][
+ 'featureMember'] =
+ ol.xml.makeArrayPusher(ol.format.GMLBase.prototype.readFeaturesInternal);
var features = ol.xml.pushParseAndPop([],
this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node,
objectStack, this.gmlFormat_);
diff --git a/test/spec/ol/format/gml/ogr.xml b/test/spec/ol/format/gml/ogr.xml
new file mode 100644
index 0000000000..5ca69e4838
--- /dev/null
+++ b/test/spec/ol/format/gml/ogr.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+ 115512.666 479836.28
+
+
+ x2
+ NL.IMGEO
+ L0001.A3C177B4105A4FFD82EB80084C8CA732
+ 60
+ 2014-02-14
+ L0001
+ fotogrammetrisch
+
+
+
diff --git a/test/spec/ol/format/gmlformat.test.js b/test/spec/ol/format/gmlformat.test.js
index 2ec050b3cb..d68aad6d27 100644
--- a/test/spec/ol/format/gmlformat.test.js
+++ b/test/spec/ol/format/gmlformat.test.js
@@ -1087,6 +1087,26 @@ describe('ol.format.GML3', function() {
});
+ describe('when parsing from OGR', function() {
+
+ var features;
+ before(function(done) {
+ afterLoadText('spec/ol/format/gml/ogr.xml', function(xml) {
+ try {
+ features = new ol.format.GML().readFeatures(xml);
+ } catch (e) {
+ done(e);
+ }
+ done();
+ });
+ });
+
+ it('reads all features', function() {
+ expect(features.length).to.be(1);
+ });
+
+ });
+
});