/// <summary>
        /// Populates this AerobicSession instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the aerobic session data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// an aerobic-session node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator aerobicSessionNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode(
                    "aerobic-session");

            Validator.ThrowInvalidIfNull(aerobicSessionNav, "AerobicSessionUnexpectedNode");

            _when = new HealthServiceDateTime();
            _when.ParseXml(aerobicSessionNav.SelectSingleNode("when"));

            _session = new AerobicData();
            _session.ParseXml(aerobicSessionNav.SelectSingleNode("session"));

            XPathNavigator samplesNav =
                aerobicSessionNav.SelectSingleNode("session-samples");
            if (samplesNav != null)
            {
                _sessionSamples = new AerobicSessionSamples();
                _sessionSamples.ParseXml(samplesNav);
            }

            XPathNodeIterator lapsIterator =
                aerobicSessionNav.Select("lap-session");

            _lapSessions = new Collection<LapSession>();
            foreach (XPathNavigator lapNav in lapsIterator)
            {
                LapSession lap = new LapSession();
                lap.ParseXml(lapNav);

                _lapSessions.Add(lap);
            }
        }
 /// <summary>
 /// Creates a new instance of the <see cref="AerobicSession"/> class with 
 /// the specified date and time and summary.
 /// </summary>
 /// 
 /// <param name="when">
 /// The date/time when the aerobic session occurred.
 /// </param>
 /// 
 /// <param name="session">
 /// The summary information about the aerobic session.
 /// </param>
 /// 
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="when"/> or <paramref name="session"/> parameter 
 /// is <b>null</b>.
 /// </exception>
 /// 
 public AerobicSession(HealthServiceDateTime when, AerobicData session)
     : base(TypeId)
 {
     this.When = when;
     this.Session = session;
 }
        /// <summary> 
        /// Populates the data for the lap from the XML.
        /// </summary>
        /// 
        /// <param name="navigator"> 
        /// The XML node representing the lap.
        /// </param>
        /// 
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        /// 
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _name =
                XPathHelper.GetOptNavValue(navigator, "name");

            _secondsIntoSession =
                XPathHelper.GetOptNavValueAsDouble(
                    navigator,
                    "seconds-into-session");

            XPathNavigator nav =
                navigator.SelectSingleNode("lap-session");

            if (nav != null)
            {
                _lapData = new AerobicData();
                _lapData.ParseXml(nav);
            }
        }