/// <summary> /// Create this class from the child class /// </summary> /// <param name="gpx"></param> public GpxClass(GPX1_1.gpxType gpx) { this.creator = gpx.creator; this.extensions = gpx.extensions; this.metadata = gpx.metadata; this.version = gpx.version; this.rte = new GPX1_1.rteTypeCollection(gpx.rte); this.trk = new GPX1_1.trkTypeCollection(gpx.trk); this.wpt = new GPX1_1.wptTypeCollection(gpx.wpt); }
/// <summary> /// Parse an XML string and return an object model that has the contents of the /// GPX file /// </summary> /// <param name="xmlString"></param> /// <returns></returns> public static GpxClass FromXml(string xmlString) { XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlString); string xml = xmlString; if (doc.DocumentElement != null && doc.DocumentElement.NamespaceURI == "http://www.topografix.com/GPX/1/0") { xml = XsltHelper.Transform(xmlString, Resources.gpx10to11); } GPX1_1.gpxType gpx = Serializer.Deserialize <GPX1_1.gpxType>(xml); return(new GpxClass(gpx)); }