                 lyrXML.@displaylevels = veLyr.displayLevels.join();
             }
         }
-        else if (layer is KMLLayer)
-        {
-            var kmlLayer:KMLLayer = layer as KMLLayer;
+        else if (layer is WebTiledLayer)
+        {
+            var webTiledLayer:WebTiledLayer = layer as WebTiledLayer;
             lyrXML = <layer label={label}
-                    type="kml"
-                    visible={kmlLayer.visible}
-                    alpha={kmlLayer.alpha}
-                    url={kmlLayer.url}/>;
+                    type="webtiled"
+                    visible={webTiledLayer.visible}
+                    alpha={webTiledLayer.alpha}
+                    url={webTiledLayer.urlTemplate}/>;
+            if (webTiledLayer.copyright)
+            {
+                lyrXML.@copyright = webTiledLayer.copyright;
+            }
+            if (webTiledLayer.displayLevels)
+            {
+                lyrXML.@displaylevels = webTiledLayer.displayLevels.join();
+            }
+            if (webTiledLayer.subDomains)
+            {
+                lyrXML.@subdomains = webTiledLayer.displayLevels.join();
+            }
         }
         else if (layer is WMSLayer)
         {

                        iseditable={feaLyr.isEditable}/>;
            }
        }
        else if (layer is OpenStreetMapLayer)
        {
            var osmLyr:OpenStreetMapLayer = layer as OpenStreetMapLayer;

                lyrXML.@displaylevels = tiledLyr.displayLevels.join();
            }
        }
        else if (layer is CSVLayer)
        {
            var csvLyr:CSVLayer = layer as CSVLayer;
            lyrXML = <layer label={label}
                    type="csv"
                    visible={csvLyr.visible}
                    alpha={csvLyr.alpha}
                    url={csvLyr.url}
                    longitudefieldname={csvLyr.longitudeFieldName}
                    latitudefieldname={csvLyr.latitudeFieldName}/>;
            if (csvLyr.columnDelimiter != ",")
            {
                lyrXML.@columndelimiter = csvLyr.columnDelimiter;
            }
            if (csvLyr.sourceFields)
            {
                var fields:Array = [];
                for each (var field:Field in csvLyr.sourceFields)
                {
                    fields.push(field.name + "|" + field.alias + "|" + field.type);
                }
                lyrXML.@sourcefields = fields.join();
            }
        }
        else if (layer is FeatureLayer && !(layer is CSVLayer))
        {
            var feaLyr:FeatureLayer = layer as FeatureLayer;
