Type Support in the System.Xml Classes

In the .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 the .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

Accessing Strongly Typed XML Data Using XPathNavigator

Reading Typed Data

Writing Typed Data