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


C# XmlReader.ReadElementContentValue方法代码示例

本文整理汇总了C#中System.Xml.XmlReader.ReadElementContentValue方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadElementContentValue方法的具体用法?C# XmlReader.ReadElementContentValue怎么用?C# XmlReader.ReadElementContentValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlReader的用法示例。


在下文中一共展示了XmlReader.ReadElementContentValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadPrimitiveValue

 internal static object ReadPrimitiveValue(XmlReader reader, IEdmPrimitiveTypeReference primitiveTypeReference)
 {
     object obj2;
     if (!PrimitiveConverter.Instance.TryTokenizeFromXml(reader, EdmLibraryExtensions.GetPrimitiveClrType(primitiveTypeReference), out obj2))
     {
         return ConvertStringToPrimitive(reader.ReadElementContentValue(), primitiveTypeReference);
     }
     return obj2;
 }
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:AtomValueUtils.cs

示例2: ReadEnumValue

        /// <summary>
        /// Reads a string value of an XML element and gets TypeName from model's EdmEnumTypeReference.
        /// </summary>
        /// <param name="reader">The XML reader to read the value from.</param>
        /// <param name="enumTypeReference">The enum rype reference.</param>
        /// <returns>An ODataEnumValue</returns>
        internal static ODataEnumValue ReadEnumValue(XmlReader reader, IEdmEnumTypeReference enumTypeReference)
        {
            Debug.Assert(reader != null, "reader != null");

            // skip the validation on value or type name.
            string stringValue = reader.ReadElementContentValue();
            string typeName = (enumTypeReference != null) ? enumTypeReference.ODataFullName() : null;
            return new ODataEnumValue(stringValue, typeName);
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:15,代码来源:AtomValueUtils.cs

示例3: ReadPrimitiveValue

        /// <summary>
        /// Reads a value of an XML element and converts it to the target primitive value.
        /// </summary>
        /// <param name="reader">The XML reader to read the value from.</param>
        /// <param name="primitiveTypeReference">The primitive type reference to convert the value to.</param>
        /// <returns>The primitive value read.</returns>
        /// <remarks>This method does not read null values, it only reads the actual element value (not its attributes).</remarks>
        /// <remarks>
        /// Pre-Condition:   XmlNodeType.Element   - the element to read the value for.
        ///                  XmlNodeType.Attribute - an attribute on the element to read the value for.
        /// Post-Condition:  XmlNodeType.Element    - the element was empty.
        ///                  XmlNodeType.EndElement - the element had some value.
        /// </remarks>
        internal static object ReadPrimitiveValue(XmlReader reader, IEdmPrimitiveTypeReference primitiveTypeReference)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(reader != null, "reader != null");

            object spatialValue;
            if (!PrimitiveConverter.Instance.TryTokenizeFromXml(reader, EdmLibraryExtensions.GetPrimitiveClrType(primitiveTypeReference), out spatialValue))
            {
                string stringValue = reader.ReadElementContentValue();
                return ConvertStringToPrimitive(stringValue, primitiveTypeReference);
            }

            return spatialValue;
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:27,代码来源:AtomValueUtils.cs


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