Take the 2-minute tour ×  I am building a webmap with the ESRI
Javascript API. I am trying to add several KML layers, as well
as a Legend Toggle and am repeatedly getting "Internal KML
Parser Error" and only some of my layers are appearing on my
map. All of my KMLs are publicly available, display properly in
Google Earth, are under 10MB, and I'm using API 3.1. The layers
that do appear work perfectly in the legend. I'm attempting to
add upwards of 20 KML layers in total. My code is as follows (I
apologize for not having the actual data, but it's proprietary):
var boundLayers = [];  var kml1 = new
esri.layers.KMLLayer('publicURL',{id:'kml1'});
boundLayers.push({layer:kml1,title:'Layer 1'});  var kml2 = new
esri.layers.KMLLayer('publicURL',{id:'kml2'});
boundLayers.push({layer:kml2,title:'Layer 2'});  var kml3 = new
esri.layers.KMLLayer('publicURL',{id:'kml3'});
boundLayers.push({layer:kml3,title:'Layer 3'});  var kml4 = new 
esri.layers.KMLLayer('http://services.nationalmap.gov/ArcGIS/res
t/services/nhd/MapS