/// <summary> /// Reads a data object from XML and returns an instance of the object. /// </summary> /// <param name="reader">An open XML reader. The reader will be closed by this /// method after reading.</param> /// <returns>Returns <b>true</b> if successful; <b>false</b> otherwise.</returns> /// <remarks>Clients should first create a new instance using a default constructor, and then /// call this method to populate the data fields of the default instance.</remarks> public override bool ReadFromXml(XmlTextReader reader) { reader.Read(); // <Trial> if (reader.Name != "Trial") { throw new XmlException("XML format error: Expected the <Trial> tag."); } _number = XmlConvert.ToInt32(reader.GetAttribute("number")); _practice = XmlConvert.ToBoolean(reader.GetAttribute("practice")); _lastCircle = CircleF.FromString(reader.GetAttribute("lastCircle")); _thisCircle = CircleF.FromString(reader.GetAttribute("thisCircle")); _isoCenter = StringEx.String2PointF(reader.GetAttribute("isoCenter")); _tInterval = XmlConvert.ToInt64(reader.GetAttribute("MT")); _start = TimePointF.FromString(reader.GetAttribute("start")); _end = TimePointF.FromString(reader.GetAttribute("end")); // read in the movement and add it to the trial _movement = new MovementData(this); _movement.ReadFromXml(reader); reader.Read(); // </Trial> if (reader.Name != "Trial" || reader.NodeType != XmlNodeType.EndElement) { throw new XmlException("XML format error: Expected the </Trial> tag."); } return(true); }