/// <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); } }
/// <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 "carolie-guideline" node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("calorie-guideline"); Validator.ThrowInvalidIfNull(itemNav, "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")); }