Share via

XmlNodeType Enum


Specifies the type of node.

public enum class XmlNodeType
public enum XmlNodeType
type XmlNodeType = 
Public Enum XmlNodeType


Attribute 2

An attribute (for example, id='123' ).


A CDATA section (for example, <![CDATA[my escaped text]]> ).

Comment 8

A comment (for example, <!-- my comment --> ).

Document 9

A document object that, as the root of the document tree, provides access to the entire XML document.

DocumentFragment 11

A document fragment.

DocumentType 10

The document type declaration, indicated by the following tag (for example, <!DOCTYPE...> ).

Element 1

An element (for example, <item> ).

EndElement 15

An end element tag (for example, </item> ).

EndEntity 16

Returned when XmlReader gets to the end of the entity replacement as a result of a call to ResolveEntity().

Entity 6

An entity declaration (for example, <!ENTITY...> ).

EntityReference 5

A reference to an entity (for example, &num; ).

None 0

This is returned by the XmlReader if a Read method has not been called.

Notation 12

A notation in the document type declaration (for example, <!NOTATION...> ).

ProcessingInstruction 7

A processing instruction (for example, <?pi test?> ).

SignificantWhitespace 14

White space between markup in a mixed content model or white space within the xml:space="preserve" scope.

Text 3

The text content of a node.

A Text node cannot have any child nodes. It can appear as the child node of the Attribute, DocumentFragment, Element, and EntityReference nodes.

Whitespace 13

White space between markup.

XmlDeclaration 17

The XML declaration (for example, <?xml version='1.0'?> ).

The XmlDeclaration node must be the first node in the document. It cannot have children. It is a child of the Document node. It can have attributes that provide version and encoding information.


The following table provides additional information about XML nodes, as well as their parent and child nodes.

Field Description Can have child nodes: Can be a child node of:
Attribute EntityReference, Text None. It is not considered a child node of an Element.
CDATA CDATA sections are used to escape blocks of text that would otherwise be recognized as markup. None. DocumentFragment, EntityReference, and Element
Comment None. Document, DocumentFragment, EntityReference
Document XmlDeclaration, Element (a maximum of one), ProcessingInstruction, Comment, DocumentType None
DocumentFragment Associates a node or subtree with a document without actually being contained within the document. Element, ProcessingInstruction, Comment, Text, CDATA, EntityReference None.
DocumentType Notation, Entity None
Element Element, Text, Comment, ProcessingInstruction, CDATA, EntityReference Document, DocumentFragment, EntityReference, Element
EndElement Returned when the XmlReader gets to the end of an element.
Entity Child nodes that represent the expanded entity (for example, Text and EntityReference nodes) DocumentType
EntityReference Element, ProcessingInstruction, Comment, Text, CDATA, EntityReference Attribute, DocumentFragment, Element, EntityReference
Notation None DocumentType
ProcessingInstruction None Document, DocumentFragment, Element, EntityReference
Text None Attribute, DocumentFragment, Element, EntityReference
XmlDeclaration Must be the first node in the document. It can have attributes that provide version and encoding information. None Document

Applies to