Beispiel #1
0
        /// <summary>
        /// Populates this <see cref="LabTestResultValue"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the lab test result value type data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If the first node in <paramref name="navigator"/> is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            // measurement
            _measurement = new GeneralMeasurement();
            _measurement.ParseXml(navigator.SelectSingleNode("measurement"));

            // ranges
            XPathNodeIterator rangesIterator = navigator.Select("ranges");

            _ranges = new Collection <TestResultRange>();
            foreach (XPathNavigator rangeNav in rangesIterator)
            {
                TestResultRange range = new TestResultRange();
                range.ParseXml(rangeNav);
                _ranges.Add(range);
            }

            // flag
            XPathNodeIterator flagsIterator = navigator.Select("flag");

            _flag = new Collection <CodableValue>();
            foreach (XPathNavigator flagNav in flagsIterator)
            {
                CodableValue singleflag = new CodableValue();
                singleflag.ParseXml(flagNav);
                _flag.Add(singleflag);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Populates this <see cref="CalorieGuideline"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the calorie guideline data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a "calorie-guideline" node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("calorie-guideline");

            Validator.ThrowInvalidIfNull(itemNav, Resources.CalorieGuidelineUnexpectedNode);

            // when (approxi-date-time, mandatory)
            _when = new ApproximateDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            // measurement-name (codable-value, mandatory)
            _name = new CodableValue();
            _name.ParseXml(itemNav.SelectSingleNode("name"));

            // calories (general-measurement, mandatory)
            _calories = new GeneralMeasurement();
            _calories.ParseXml(itemNav.SelectSingleNode("calories"));
        }