本文整理汇总了C#中Length.ParseXml方法的典型用法代码示例。如果您正苦于以下问题:C# Length.ParseXml方法的具体用法?C# Length.ParseXml怎么用?C# Length.ParseXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Length
的用法示例。
在下文中一共展示了Length.ParseXml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseXml
/// <summary>
/// Populates this <see cref="BodyDimension"/> instance from the data in the XML.
/// </summary>
///
/// <param name="typeSpecificXml">
/// The XML to get the body dimension data from.
/// </param>
///
/// <exception cref="InvalidOperationException">
/// If the first node in <paramref name="typeSpecificXml"/> is not
/// a "body-dimension" node.
/// </exception>
///
protected override void ParseXml(IXPathNavigable typeSpecificXml)
{
XPathNavigator itemNav =
typeSpecificXml.CreateNavigator().SelectSingleNode("body-dimension");
Validator.ThrowInvalidIfNull(itemNav, "BodyDimensionUnexpectedNode");
// 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 (Length, mandatory)
_value = new Length();
_value.ParseXml(itemNav.SelectSingleNode("value"));
}
示例2: ParseXml
/// <summary>
/// Populates this <see cref="Height"/> instance from the data in the XML.
/// </summary>
///
/// <param name="typeSpecificXml">
/// The XML to get the height data from.
/// </param>
///
/// <exception cref="InvalidOperationException">
/// The first node in <paramref name="typeSpecificXml"/> is not
/// a height node.
/// </exception>
///
protected override void ParseXml(IXPathNavigable typeSpecificXml)
{
XPathNavigator heightNav =
typeSpecificXml.CreateNavigator().SelectSingleNode("height");
Validator.ThrowInvalidIfNull(heightNav, "HeightUnexpectedNode");
_when = new HealthServiceDateTime();
_when.ParseXml(heightNav.SelectSingleNode("when"));
_value = new Length();
_value.ParseXml(heightNav.SelectSingleNode("value"));
}
示例3: ParseXml
/// <summary>
/// Populates the data for the length from the XML.
/// </summary>
///
/// <param name="navigator">
/// The XML node representing the length.
/// </param>
///
/// <exception cref="ArgumentNullException">
/// The <paramref name="navigator"/> parameter is <b>null</b>.
/// </exception>
///
public override void ParseXml(XPathNavigator navigator)
{
Validator.ThrowIfNavigatorNull(navigator);
XPathNavigator modeNav =
navigator.SelectSingleNode("mode");
_mode.Clear();
if (modeNav != null)
{
_mode.ParseXml(modeNav);
}
XPathNavigator distanceNav =
navigator.SelectSingleNode("distance");
if (distanceNav != null)
{
_distance = new Length();
_distance.ParseXml(distanceNav);
}
_minutes =
XPathHelper.GetOptNavValueAsDouble(navigator, "minutes");
int? intensity =
XPathHelper.GetOptNavValueAsInt(navigator, "intensity");
if (intensity != null)
{
_intensity = (RelativeRating)((int)intensity);
}
_peakHr =
XPathHelper.GetOptNavValueAsInt(navigator, "peak-heartrate");
_averageHr =
XPathHelper.GetOptNavValueAsInt(navigator, "avg-heartrate");
_minHr =
XPathHelper.GetOptNavValueAsInt(navigator, "min-heartrate");
_energy =
XPathHelper.GetOptNavValueAsDouble(navigator, "energy");
_energyFromFat =
XPathHelper.GetOptNavValueAsDouble(navigator, "energy-from-fat");
_peakSpeed =
XPathHelper.GetOptNavValue<SpeedMeasurement>(
navigator,
"peak-speed");
_averageSpeed =
XPathHelper.GetOptNavValue<SpeedMeasurement>(
navigator,
"avg-speed");
_minSpeed =
XPathHelper.GetOptNavValue<SpeedMeasurement>(
navigator,
"min-speed");
_peakPace =
XPathHelper.GetOptNavValue<PaceMeasurement>(
navigator,
"peak-pace");
_averagePace =
XPathHelper.GetOptNavValue<PaceMeasurement>(
navigator,
"avg-pace");
_minPace =
XPathHelper.GetOptNavValue<PaceMeasurement>(
navigator,
"min-pace");
_peakPower =
XPathHelper.GetOptNavValue<PowerMeasurement>(
navigator,
"peak-power");
_averagePower =
XPathHelper.GetOptNavValue<PowerMeasurement>(
navigator,
"avg-power");
_minPower =
//.........这里部分代码省略.........