Xml Document

The XmlDocument class represents an entire XML document as a DOM tree and can be used to add, delete, and change nodes in the tree. DOM trees consist of nodes of different types, as shown in Figure 5.1.

Figure 5.1: A DOM tree is a collection of nodes of different types.

Note how attributes and the text content of elements are nodes in their own right. The document itself is represented by a Document node (often known as the document element), and beneath this is an Element node that represents the root of the XML document, shown shaded in gray in the figure. Table 5.5 lists the types of nodes that you may find in an XmlDocument DOM tree.

Table 5.5: IIpiIĀ«:!!.

Class

Description

XmlAttribute

Represents an attribute on a node

XmlCDataSection

Represents a CDATA section

XmlComment

Represents a comment

Table 5.5: l|piMkĀ«Ili

Class

Description

XmlDeclaration

Represents an XML declaration

XmlDocumentType

Represents a DOCTYPE declaration

XmlElement

Represents an element

XmlEntityReference

Represents an entity reference

XmlProcessinglnstruction

Represents a processing instruction

XmlText

Represents the text content of a node

0 0

Post a comment