/// <summary>
        /// Populates this SleepJournalAM instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the morning sleep journal data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in the <paramref name="typeSpecificXml"/> parameter 
        /// is not a sleep-am node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator sleepNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("sleep-am");

            Validator.ThrowInvalidIfNull(sleepNav, "SleepJournalAMUnexpectedNode");

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

            _bedtime = new ApproximateTime();
            _bedtime.ParseXml(sleepNav.SelectSingleNode("bed-time"));

            _wakeTime = new ApproximateTime();
            _wakeTime.ParseXml(sleepNav.SelectSingleNode("wake-time"));

            _sleepMinutes =
                sleepNav.SelectSingleNode("sleep-minutes").ValueAsInt;

            _settlingMinutes =
                sleepNav.SelectSingleNode("settling-minutes").ValueAsInt;

            XPathNodeIterator awakeningsIterator =
                sleepNav.Select("awakening");

            foreach (XPathNavigator awakeningNav in awakeningsIterator)
            {
                Occurrence awakening = new Occurrence();
                awakening.ParseXml(awakeningNav);
                _awakenings.Add(awakening);
            }

            XPathNavigator medNav = sleepNav.SelectSingleNode("medications");

            if (medNav != null)
            {
                _medications = new CodableValue();
                _medications.ParseXml(medNav);
            }

            _wakeState =
                (WakeState)
                sleepNav.SelectSingleNode("wake-state").ValueAsInt;
        }
        /// <summary>
        /// Populates this <see cref="SleepJournalPM"/> instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the evening sleep journal data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a sleep-pm node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator sleepNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("sleep-pm");

            Validator.ThrowInvalidIfNull(sleepNav, "SleepJournalPMUnexpectedNode");

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

            XPathNodeIterator caffeineNodes = sleepNav.Select("caffeine");
            foreach (XPathNavigator caffeineNav in caffeineNodes)
            {
                ApproximateTime caffeineTaken = new ApproximateTime();
                caffeineTaken.ParseXml(caffeineNav);
                _caffeine.Add(caffeineTaken);
            }

            XPathNodeIterator alcoholNodes = sleepNav.Select("alcohol");
            foreach (XPathNavigator alcoholNav in alcoholNodes)
            {
                ApproximateTime alcoholTaken = new ApproximateTime();
                alcoholTaken.ParseXml(alcoholNav);
                _alcohol.Add(alcoholTaken);
            }

            XPathNodeIterator napNodes = sleepNav.Select("nap");
            foreach (XPathNavigator napNav in napNodes)
            {
                Occurrence napTaken = new Occurrence();
                napTaken.ParseXml(napNav);
                _naps.Add(napTaken);
            }

            XPathNodeIterator exerciseNodes = sleepNav.Select("exercise");
            foreach (XPathNavigator exerciseNav in exerciseNodes)
            {
                Occurrence exerciseTaken = new Occurrence();
                exerciseTaken.ParseXml(exerciseNav);
                _exercise.Add(exerciseTaken);
            }

            _sleepiness =
                (Sleepiness)
                sleepNav.SelectSingleNode("sleepiness").ValueAsInt;
        }