当前位置: 首页>>代码示例>>C#>>正文


C# Length.ParseXml方法代码示例

本文整理汇总了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"));
        }
开发者ID:marteaga,项目名称:healthvault-azurestorage,代码行数:32,代码来源:BodyDimension.cs

示例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"));
        }
开发者ID:marteaga,项目名称:healthvault-azurestorage,代码行数:26,代码来源:Height.cs

示例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 =
//.........这里部分代码省略.........
开发者ID:marteaga,项目名称:healthvault-azurestorage,代码行数:101,代码来源:AerobicData.cs


注:本文中的Length.ParseXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。