public static KmlFeatureCollection GetFromChildren(XElement xml) { List <KmlFeature> temp = new List <KmlFeature>(); foreach (XElement element in xml.Elements()) { switch (element.Name.LocalName) { case "Placemark": temp.Add(KmlPlacemark.Parse(element)); break; case "Folder": temp.Add(KmlFolder.Parse(element)); break; case "Document": temp.Add(KmlDocument.Parse(element)); break; } } return(temp.ToArray()); }