Skip to content

Commit

Permalink
Merge pull request #3895 from Aviture/kml-accept-url-link
Browse files Browse the repository at this point in the history
add support for invalid but common URL tag inside of NetworkLink KML
  • Loading branch information
mramato committed May 5, 2016
2 parents b1b249f + 54ea114 commit 2b6742e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ define([
}
id = uri + '#' + tokens[1];
}

styleEntity = styleCollection.getById(id);
if (!defined(styleEntity)) {
styleEntity = styleCollection.getById('#' + id);
Expand Down Expand Up @@ -1827,6 +1827,10 @@ define([
var networkEntity = r.entity;

var link = queryFirstNode(node, 'Link', namespaces.kml);

if(!defined(link)){
link = queryFirstNode(node, 'Url', namespaces.kml);
}
if (defined(link)) {
var href = queryStringValue(link, 'href', namespaces.kml);
if (defined(href)) {
Expand Down
21 changes: 21 additions & 0 deletions Specs/DataSources/KmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3116,6 +3116,27 @@ defineSuite([
});
});

it('NetworkLink can accept invalid but common URL tag instead of Link', function(){
var kml = '<?xml version="1.0" encoding="UTF-8"?>\
<NetworkLink id="link">\
<Url>\
<href>./Data/KML/refresh.kml</href>\
</Url>\
</NetworkLink>';

var requestNetworkLink = when.defer();
spyOn(loadWithXhr, 'load').and.callFake(function(url, responseType, method, data, headers, deferred, overrideMimeType) {
requestNetworkLink.resolve(url);
deferred.reject();
});

KmlDataSource.load(parser.parseFromString(kml, "text/xml"), options);

return requestNetworkLink.promise.then(function(url) {
expect(url).toEqual('./Data/KML/refresh.kml');
});
});

it('NetworkLink: Url is correct on initial load with onStop defaults', function() {
var kml = '<?xml version="1.0" encoding="UTF-8"?>\
<NetworkLink id="link">\
Expand Down

0 comments on commit 2b6742e

Please sign in to comment.