From dba6e04a1b28098b8f8b0afbde1b9a93a5b96d9f Mon Sep 17 00:00:00 2001 From: oterral Date: Mon, 7 Sep 2015 13:14:24 +0200 Subject: [PATCH] Parse nested document tag --- src/ol/format/kmlformat.js | 1 + test/spec/ol/format/kmlformat.test.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ol/format/kmlformat.js b/src/ol/format/kmlformat.js index 192b15cd63..6816ea6cb1 100644 --- a/src/ol/format/kmlformat.js +++ b/src/ol/format/kmlformat.js @@ -1642,6 +1642,7 @@ ol.format.KML.prototype.readDocumentOrFolder_ = function(node, objectStack) { // FIXME use scope somehow var parsersNS = ol.xml.makeStructureNS( ol.format.KML.NAMESPACE_URIS_, { + 'Document': ol.xml.makeArrayExtender(this.readDocumentOrFolder_, this), 'Folder': ol.xml.makeArrayExtender(this.readDocumentOrFolder_, this), 'Placemark': ol.xml.makeArrayPusher(this.readPlacemark_, this), 'Style': goog.bind(this.readSharedStyle_, this), diff --git a/test/spec/ol/format/kmlformat.test.js b/test/spec/ol/format/kmlformat.test.js index f1262746d7..1b38e6ae7b 100644 --- a/test/spec/ol/format/kmlformat.test.js +++ b/test/spec/ol/format/kmlformat.test.js @@ -2102,6 +2102,19 @@ describe('ol.format.KML', function() { expect(fs[0]).to.be.an(ol.Feature); }); + it('can read a single feature from nested Document', function() { + var text = + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ''; + var fs = format.readFeatures(text); + expect(fs).to.have.length(1); + expect(fs[0]).to.be.an(ol.Feature); + }); + it('can transform and read a single feature from a Document', function() { var text = '' +