private void addLegendElement(FeatureLayer layer, XmlDocument doc, XmlElement layerElement)
{
XmlElement legendSettings = doc.CreateElement("legend_settings");
layerElement.AppendChild(legendSettings);
addAttribute(doc, legendSettings, "display_point_sample", layer.LegendSettings.DisplayPointSample ? "1" : "0");
addAttribute(doc, legendSettings, "display_polyline_sample", layer.LegendSettings.DisplayPolylineSample ? "1" : "0");
addAttribute(doc, legendSettings, "display_polygon_sample", layer.LegendSettings.DisplayPolygonSample ? "1" : "0");
addAttribute(doc, legendSettings, "point_sample_title", layer.LegendSettings.PointSampleTitle);
addAttribute(doc, legendSettings, "polyline_sample_title", layer.LegendSettings.PolylineSampleTitle);
addAttribute(doc, legendSettings, "polygon_sample_title", layer.LegendSettings.PolygonSampleTitle);
}