ערוך

שתף באמצעות


Type Support in the System.Xml Classes

In .NET Framework version 2.0, the core XML classes have been enhanced to include type support features. The XmlReader, XmlWriter, and XPathNavigator classes include type support features including the ability to convert between XML Schema types and common language runtime (CLR) types.

In .NET Framework version 2.0, the XmlReader, XmlWriter, and XPathNavigator classes have been enhanced to include type support features.

  • The XmlReader and XPathNavigator classes each include a SchemaInfo property that returns the schema information on a node.

  • The ReadContentAs and ReadElementContentAs and methods on the XmlReader class read a text value and convert it to a CLR value in a single method call.

  • The WriteValue method on the XmlWriter class converts a CLR type to an XML Schema type when writing out XML.

  • The ValueAs and TypedValue properties on the XPathNavigator class return a node value and convert it to a CLR value in a single method call.

Note

In the .NET Framework version 1.0 the XmlConvert class was needed to convert between XML Schema and CLR types.

In This Section

Mapping XML Data Types to CLR Types
Describes the default mappings of XML data types to CLR types.

XML Type Support Implementation Notes
Discusses some of the type support implementation details.

Conversion of XML Data Types
Describes how to use the XmlConvert class to convert between XML Schema and CLR types.

Accessing Strongly Typed XML Data Using XPathNavigator