private GpxTrackSegment ReadGpxTrackSegment() { GpxTrackSegment segment = new GpxTrackSegment(); if (Reader_.IsEmptyElement) { return(segment); } string elementName = Reader_.Name; while (Reader_.Read()) { switch (Reader_.NodeType) { case XmlNodeType.Element: switch (Reader_.Name) { case "trkpt": segment.TrackPoints.Add(ReadGpxTrackPoint()); break; case "extensions": ReadTrackSegmentExtensions(); break; default: SkipElement(); break; } break; case XmlNodeType.EndElement: if (Reader_.Name != elementName) { throw new FormatException(Reader_.Name); } return(segment); } } throw new FormatException(elementName); }