Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert missing namespace declarations for KMZ files #6003

Merged
merged 5 commits into from
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
Binary file added Specs/Data/KML/undeclaredNamespaces.kmz
Binary file not shown.
10 changes: 9 additions & 1 deletion Specs/DataSources/KmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,22 @@ 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);
expect(source.entities.values.length).toEqual(1);
});
});

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);
Expand Down