/// <summary> /// return an xml element /// </summary> /// <param name="doc">xml document to add the data to</param> /// <returns>an xml element</returns> public XmlElement getXml(XmlDocument doc) { XmlElement elem = doc.CreateElement("Document"); doc.DocumentElement.AppendChild(elem); xml.AddTextElement(doc, elem, "name", Name); xml.AddTextElement(doc, elem, "description", Description); if (Polygons.Count > 0) { XmlElement elemPoly = doc.CreateElement("Polygons"); elem.AppendChild(elemPoly); for (int i = 0; i < Polygons.Count; i++) { kmlPlacemarkPolygon poly = (kmlPlacemarkPolygon)Polygons[i]; elemPoly.AppendChild(poly.getXml(doc)); } } if (Points.Count > 0) { XmlElement elemPoints = doc.CreateElement("Points"); elem.AppendChild(elemPoints); for (int i = 0; i < Points.Count; i++) { kmlPlacemarkPoint pt = (kmlPlacemarkPoint)Points[i]; elemPoints.AppendChild(pt.getXml(doc)); } } if (Paths.Count > 0) { XmlElement elemPaths = doc.CreateElement("Paths"); elem.AppendChild(elemPaths); for (int i = 0; i < Paths.Count; i++) { kmlPlacemarkPath path = (kmlPlacemarkPath)Paths[i]; elemPaths.AppendChild(path.getXml(doc)); } } return(elem); }