From 54ea114bb64c36bb5a3b9a48dad4cb2459ded7c8 Mon Sep 17 00:00:00 2001 From: Mike Macaulay Date: Wed, 4 May 2016 11:23:40 -0500 Subject: [PATCH] add support for invalid but common URL tag inside of NetworkLink KML --- Source/DataSources/KmlDataSource.js | 6 +++++- Specs/DataSources/KmlDataSourceSpec.js | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Source/DataSources/KmlDataSource.js b/Source/DataSources/KmlDataSource.js index 42170e05c176..31ae7448e2a9 100644 --- a/Source/DataSources/KmlDataSource.js +++ b/Source/DataSources/KmlDataSource.js @@ -835,7 +835,7 @@ define([ } id = uri + '#' + tokens[1]; } - + styleEntity = styleCollection.getById(id); if (!defined(styleEntity)) { styleEntity = styleCollection.getById('#' + id); @@ -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)) { diff --git a/Specs/DataSources/KmlDataSourceSpec.js b/Specs/DataSources/KmlDataSourceSpec.js index 861b8f7f0256..f8ce25ac154d 100644 --- a/Specs/DataSources/KmlDataSourceSpec.js +++ b/Specs/DataSources/KmlDataSourceSpec.js @@ -3116,6 +3116,27 @@ defineSuite([ }); }); + it('NetworkLink can accept invalid but common URL tag instead of Link', function(){ + var kml = '\ + \ + \ + ./Data/KML/refresh.kml\ + \ + '; + + 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 = '\ \