/// <summary> /// Populates this <see cref="CarePlanGoal"/> instance from the data in the specified XML. /// </summary> /// /// <param name="navigator"> /// The XML to get the CarePlanGoal data from. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="navigator"/> parameter is <b>null</b>. /// </exception> /// public override void ParseXml(XPathNavigator navigator) { Validator.ThrowIfNavigatorNull(navigator); _name = XPathHelper.GetOptNavValue <CodableValue>(navigator, "name"); _description = XPathHelper.GetOptNavValue(navigator, "description"); _startDate = XPathHelper.GetOptNavValue <ApproximateDateTime>(navigator, "start-date"); _endDate = XPathHelper.GetOptNavValue <ApproximateDateTime>(navigator, "end-date"); _targetCompletionDate = XPathHelper.GetOptNavValue <ApproximateDateTime>(navigator, "target-completion-date"); _goalAssociatedTypeInfo = XPathHelper.GetOptNavValue <AssociatedTypeInfo>(navigator, "associated-type-info"); _targetRange = XPathHelper.GetOptNavValue <GoalRange>(navigator, "target-range"); _goalAdditionalRanges.Clear(); foreach (XPathNavigator nav in navigator.Select("goal-additional-ranges")) { GoalRange goalRange = new GoalRange(); goalRange.ParseXml(nav); _goalAdditionalRanges.Add(goalRange); } _recurrence = XPathHelper.GetOptNavValue <GoalRecurrence>(navigator, "recurrence"); _referenceId = XPathHelper.GetOptNavValue(navigator, "reference-id"); }
/// <summary> /// Populates this <see cref="HealthGoal"/> instance from the data in the specified XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the HealthGoal data from. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="typeSpecificXml"/> parameter is <b>null</b>. /// </exception> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a HealthGoal node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { if (typeSpecificXml == null) { throw new ArgumentNullException( "typeSpecificXml", Resources.ParseXmlNavNull); } XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("health-goal"); if (itemNav == null) { throw new InvalidOperationException( Resources.HealthGoalUnexpectedNode); } _name = new CodableValue(); _name.ParseXml(itemNav.SelectSingleNode("name")); _description = XPathHelper.GetOptNavValue(itemNav, "description"); _startDate = XPathHelper.GetOptNavValue <ApproximateDateTime>(itemNav, "start-date"); _endDate = XPathHelper.GetOptNavValue <ApproximateDateTime>(itemNav, "end-date"); _associatedTypeInfo = XPathHelper.GetOptNavValue <AssociatedTypeInfo>(itemNav, "associated-type-info"); _targetRange = XPathHelper.GetOptNavValue <GoalRange>(itemNav, "target-range"); _goalAdditionalRanges.Clear(); foreach (XPathNavigator nav in itemNav.Select("goal-additional-ranges")) { GoalRange goalRange = new GoalRange(); goalRange.ParseXml(nav); _goalAdditionalRanges.Add(goalRange); } _recurrence = XPathHelper.GetOptNavValue <GoalRecurrence>(itemNav, "recurrence"); }