diff --git a/CHANGES.md b/CHANGES.md index 127634c13ccb..500179bfd927 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ Change Log * Added ability to support touch event in Imagery Layers Split demo application. [#5948](https://github.com/AnalyticalGraphicsInc/cesium/pull/5948) * Fixed `Invalid asm.js: Invalid member of stdlib` console error by recompiling crunch.js with latest emscripten toolchain. [#5847](https://github.com/AnalyticalGraphicsInc/cesium/issues/5847) * Added CZML support for `polyline.depthFailMaterial`, `label.scaleByDistance`, `distanceDisplayCondition`, and `disableDepthTestDistance`. [#5986](https://github.com/AnalyticalGraphicsInc/cesium/pull/5986) +* Fixed handling of KMZ files with missing `xsi` namespace declarations. [#6003](https://github.com/AnalyticalGraphicsInc/cesium/pull/6003) * Fixed a bug where models with animations of different lengths would cause an error. [#5694](https://github.com/AnalyticalGraphicsInc/cesium/issues/5694) * Added a `clampAnimations` parameter to `Model` and `Entity.model`. Setting this to `false` allows different length animations to loop asynchronously over the duration of the longest animation. diff --git a/Source/DataSources/KmlDataSource.js b/Source/DataSources/KmlDataSource.js index 9f8388e3a223..ffe1fb1ef593 100644 --- a/Source/DataSources/KmlDataSource.js +++ b/Source/DataSources/KmlDataSource.js @@ -284,6 +284,7 @@ define([ function loadXmlFromZip(reader, entry, uriResolver, deferred) { entry.getData(new zip.TextWriter(), function(text) { + text = insertNamespaces(text); uriResolver.kml = parser.parseFromString(text, 'application/xml'); deferred.resolve(); }); diff --git a/Specs/Data/KML/undeclaredNamespaces.kmz b/Specs/Data/KML/undeclaredNamespaces.kmz new file mode 100644 index 000000000000..0c2397950d11 Binary files /dev/null and b/Specs/Data/KML/undeclaredNamespaces.kmz differ diff --git a/Specs/DataSources/KmlDataSourceSpec.js b/Specs/DataSources/KmlDataSourceSpec.js index d5daecf6fdb3..2bdfb3d2279a 100644 --- a/Specs/DataSources/KmlDataSourceSpec.js +++ b/Specs/DataSources/KmlDataSourceSpec.js @@ -244,7 +244,7 @@ defineSuite([ }); }); - it('load inserts missing namespace declaration', function() { + it('load inserts missing namespace declaration into kml', function() { var dataSource = new KmlDataSource(options); return dataSource.load('Data/KML/undeclaredNamespaces.kml').then(function(source) { expect(source).toBe(dataSource); @@ -252,6 +252,14 @@ defineSuite([ }); }); + it('load inserts missing namespace declaration into kmz', function() { + var dataSource = new KmlDataSource(options); + return dataSource.load('Data/KML/undeclaredNamespaces.kmz').then(function(source) { + expect(source).toBe(dataSource); + expect(source.entities.values.length).toEqual(1); + }); + }); + it('load rejects nonexistent URL', function() { return KmlDataSource.load('test.invalid', options).otherwise(function(e) { expect(e).toBeInstanceOf(RequestErrorEvent);