Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (51 sloc) 6.27 KB
title ms.date ms.technology ms.assetid author ms.author
XML Documents and Data
03/30/2017
dotnet-standard
e695047f-3c0f-4045-8708-5baea91cc380
mairaw
mairaw

XML Documents and Data

The .NET Framework provides a comprehensive and integrated set of classes that enable you to build XML-aware apps easily. The classes in the following namespaces support parsing and writing XML, editing XML data in memory, data validation, and XSLT transformation.

  • xref:System.Xml

  • xref:System.Xml.XPath

  • xref:System.Xml.Xsl

  • xref:System.Xml.Schema

  • xref:System.Xml.Linq

For a full list, search for "System.Xml" on the .NET API browser.

The classes in these namespaces support World Wide Web Consortium (W3C) recommendations. For example:

The XML classes in the .NET Framework provide these benefits:

  • Productivity. LINQ to XML (C#) and LINQ to XML (Visual Basic) makes it easier to program with XML and provides a query experience that is similar to SQL.

  • Extensibility. The XML classes in the .NET Framework are extensible through the use of abstract base classes and virtual methods. For example, you can create a derived class of the xref:System.Xml.XmlUrlResolver class that stores the cache stream to the local disk.

  • Pluggable architecture. The .NET Framework provides an architecture in which components can utilize one another, and data can be streamed between components. For example, a data store, such as an xref:System.Xml.XPath.XPathDocument or xref:System.Xml.XmlDocument object, can be transformed with the xref:System.Xml.Xsl.XslCompiledTransform class, and the output can then be streamed either into another store or returned as a stream from a web service.

  • Performance. For better app performance, some of the XML classes in the .NET Framework support a streaming-based model with the following characteristics:

    • Minimal caching for forward-only, pull-model parsing (xref:System.Xml.XmlReader).

    • Forward-only validation (xref:System.Xml.XmlReader).

    • Cursor style navigation that minimizes node creation to a single virtual node while providing random access to the document (xref:System.Xml.XPath.XPathNavigator).

    For better performance whenever XSLT processing is required, you can use the xref:System.Xml.XPath.XPathDocument class, which is an optimized, read-only store for XPath queries designed to work efficiently with the xref:System.Xml.Xsl.XslCompiledTransform class.

  • Integration with ADO.NET. The XML classes and ADO.NET are tightly integrated to bring together relational data and XML. The xref:System.Data.DataSet class is an in-memory cache of data retrieved from a database. The xref:System.Data.DataSet class has the ability to read and write XML by using the xref:System.Xml.XmlReader and xref:System.Xml.XmlWriter classes, to persist its internal relational schema structure as XML schemas (XSD), and to infer the schema structure of an XML document.

In This Section

XML Processing Options Discusses options for processing XML data.

Processing XML Data In-Memory Discusses the three models for processing XML data in-memory: LINQ to XML (C#) and LINQ to XML (Visual Basic), the xref:System.Xml.XmlDocument class (based on the W3C Document Object Model), and the xref:System.Xml.XPath.XPathDocument class (based on the XPath data model).

XSLT Transformations
Describes how to use the XSLT processor.

XML Schema Object Model (SOM)
Describes the classes used for building and manipulating XML Schemas (XSD) by providing an xref:System.Xml.Schema.XmlSchema class to load and edit a schema.

XML Integration with Relational Data and ADO.NET
Describes how the .NET Framework enables real-time, synchronous access to both the relational and hierarchical representations of data through the xref:System.Data.DataSet object and the xref:System.Xml.XmlDataDocument object.

Managing Namespaces in an XML Document
Describes how the xref:System.Xml.XmlNamespaceManager class is used to store and maintain namespace information.

Type Support in the System.Xml Classes
Describes how XML data types map to CLR types, how to convert XML data types, and other type support features in the xref:System.Xml classes.

Related Sections

ADO.NET
Provides information on how to access data using ADO.NET.

Security
Provides an overview of the .NET Framework security system.

You can’t perform that action at this time.