.NET Framework Class Library
XmlDocument Class

Represents an XML document.

Namespace: System.Xml
Assembly: System.Xml (in system.xml.dll)

Syntax

Visual Basic (Declaration)
Public Class XmlDocument
    Inherits XmlNode
Visual Basic (Usage)
Dim instance As XmlDocument
C#
public class XmlDocument : XmlNode
C++
public ref class XmlDocument : public XmlNode
J#
public class XmlDocument extends XmlNode
JScript
public class XmlDocument extends XmlNode
Remarks

This class implements the W3C Document Object Model (DOM) Level 1 Core and the Core DOM Level 2. The DOM is an in-memory (cache) tree representation of an XML document and enables the navigation and editing of this document. Because XmlDocument implements the IXPathNavigable interface it can also be used as the source document for the XslTransform class.

The XmlDataDocument class extends XmlDocument and allows structured data to be stored, retrieved, and manipulated through a relational DataSet. This class allows components to mix XML and relational views of the underlying data.

See XML Document Object Model (DOM) for more information.

Security noteSecurity Note

Exceptions raised as a result of using the XmlDocument class, such as the XmlException class may contain sensitive information that should not be exposed in untrusted scenarios. Exceptions should be properly handled so that this sensitive information is not exposed in untrusted scenarios.

TopicLocation
How to: Load XML Data in the XML Web Server ControlBuilding ASP .NET Web Applications
How to: Load XML Data in the XML Web Server ControlBuilding ASP .NET Web Applications
How to: Load XML Data in the XML Web Server ControlBuilding ASP .NET Web Applications in Visual Studio
How to: Load XML Data in the XML Web Server ControlBuilding ASP .NET Web Applications in Visual Studio
Inheritance Hierarchy

System.Object
   System.Xml.XmlNode
    System.Xml.XmlDocument
       System.Configuration.ConfigXmlDocument
       System.Xml.XmlDataDocument
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
See Also

Tags :


Community Content

coldstar
Table Example
I believe that what the XML documentation is lacking at the moment is an example of how an XML document can be used as a table in lieu of a table in a database. An example would include the CRUD model showing an XML document being handled as a table. I am working on this to place here. If you have any current examples please place them here.
Tags :

Thomas Lee
How to read XMLNode from a XML Document.

Here is some sample XML we want to read:

<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="Path" value="C:\DATA\Blitz\BlitzTest" />
<add key="SourcePath" value="C:\toolbox\Visual Studio 2005\Projects\Blitz Reporting\Blitz Reporting\" />
</appSettings>
</configuration>

'

Here is some sample VB code that shows you how to read these nodes.

Dim XMLDoc AsNew Xml.XmlDocument 
XMLDoc.Load("web.config") 'xml file you want to load
Dim node As Xml.XmlNode = XMLDoc.SelectSingleNode("/configuration/appSettings") 'node path
Dim Path AsString = node.ChildNodes(0).Attributes("value").Value 
Dim SourcePath AsString = node.ChildNodes(1).Attributes("value").Value 

'

As you can guess the values look like the following:

Path = "C:\DATA\Blitz\BlitzTest"
SourcePath = "C:\toolbox\Visual Studio 2005\Projects\Blitz Reporting\Blitz Reporting\"
Tags : xml

Page view tracker