/// <summary> /// Populates this vital signs instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the vital signs data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a vital signs node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("vital-signs"); Validator.ThrowInvalidIfNull(itemNav, Resources.VitalSignsUnexpectedNode); _when = new HealthServiceDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); XPathNodeIterator vitalSignsResultsIterator = itemNav.Select("vital-signs-results"); foreach (XPathNavigator vitalSignsResultsNav in vitalSignsResultsIterator) { VitalSignsResultType vitalSignResult = new VitalSignsResultType(); vitalSignResult.ParseXml(vitalSignsResultsNav); _vitalSignsResults.Add(vitalSignResult); } // <site> _site = XPathHelper.GetOptNavValue(itemNav, "site"); // <position> _position = XPathHelper.GetOptNavValue(itemNav, "position"); }
/// <summary> /// Gets a string representation of the vital signs results. /// </summary> /// /// <returns> /// A string representing the vital signs results. /// </returns> /// public override string ToString() { StringBuilder result = new StringBuilder(100); if (VitalSignsResults.Count > 0) { for (int index = 0; index < VitalSignsResults.Count; ++index) { if (index > 0) { result.Append( Resources.ListSeparator); } VitalSignsResultType vitalSign = VitalSignsResults[index]; result.Append(vitalSign); } } else { result.Append(When); } return(result.ToString()); }