/// <summary> /// Creates an instance of information about the body composition of the record owner /// with specified time, measurement name, and value. /// </summary> /// /// <remarks> /// Examples: % body fat, lean muscle mass. /// </remarks> /// /// <param name="when"> /// The date and time of the measurement. /// </param> /// /// <param name="measurementName"> /// The name of the measurement. /// </param> /// /// <param name="compositionValue"> /// The value of the measurement. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="when"/>, <paramref name="measurementName"/> or /// <paramref name="compositionValue"/> is <b>null</b>. /// </exception> /// public BodyComposition( ApproximateDateTime when, CodableValue measurementName, BodyCompositionValue compositionValue) : base(TypeId) { When = when; MeasurementName = measurementName; Value = compositionValue; }
/// <summary> /// Populates this <see cref="BodyComposition"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the body composition data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a "body-composition" node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("body-composition"); Validator.ThrowInvalidIfNull(itemNav, "BodyCompositionUnexpectedNode"); // when (approxi-date-time, mandatory) _when = new ApproximateDateTime(); _when.ParseXml(itemNav.SelectSingleNode("when")); // measurement-name (codable-value, mandatory) _measurementName = new CodableValue(); _measurementName.ParseXml(itemNav.SelectSingleNode("measurement-name")); // value (BodyCompositionValue, mandatory) _value = new BodyCompositionValue(); _value.ParseXml(itemNav.SelectSingleNode("value")); // measurement-method (codable value ) _measurementMethod = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "measurement-method"); // site _site = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "site"); }