code: function (url, controls) {
          var self = this;
          if (!url) {
              throw new ArgumentError(
                  Logger.logMessage(Logger.LEVEL_SEVERE, "KmlFile", "constructor", "invalidDocumentPassed")
              );
          }
  
          // Default values.
          this._controls = controls || null;
          this._fileCache = new KmlFileCache();
          this._styleResolver = new StyleResolver(this._fileCache);
          this._listener = new RefreshListener();
          this._headers = null;
  
          return this.requestRemote(url).then(function (options) {
              var loadedDocument = options.text;
              self._headers = options.headers;
  
              if (!self.hasExtension("kmz", url)) {
                  return loadedDocument;
              } else {
                  var kmzFile = new KmzFile(loadedDocument, self._fileCache);
                  return kmzFile.load();
              }
          }).then(function (rootDocument) {
              self._document = new XmlDocument(rootDocument).dom();
              KmlObject.call(self, {objectNode: self._document.documentElement, controls: controls});
  
              self._fileCache.add(url, self, true);
  
              return self;
          });
      }
docs: TODO: Make sure that the KmlFile is also rendered as a part of this hierarchy and not added to the layer. 
  Constructs an object for Kml file. Applications usually don't call this constructor.
  Parses associated KmlFile and allows user to draw the whole KmlFile in passed layer. The whole file is
  rendered in one Layer.
  @constructor
  @param url {String} Url of the remote document.
  @param controls {KmlControls[]} List of controls applied to this File.
  @alias KmlFile
  @classdesc Support for Kml File parsing and display.
  @augments KmlObject