XmlNodeType XmlNodeType XmlNodeType XmlNodeType Enum


Specifies the type of node.

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


Attribute Attribute Attribute Attribute 2

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


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

Comment Comment Comment Comment 8

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

Document Document Document Document 9

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

DocumentFragment DocumentFragment DocumentFragment DocumentFragment 11

A document fragment.

DocumentType DocumentType DocumentType DocumentType 10

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

Element Element Element Element 1

An element (for example, <item> ).

EndElement EndElement EndElement EndElement 15

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

EndEntity EndEntity EndEntity EndEntity 16

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

Entity Entity Entity Entity 6

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

EntityReference EntityReference EntityReference EntityReference 5

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

None None None None 0

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

Notation Notation Notation Notation 12

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

ProcessingInstruction ProcessingInstruction ProcessingInstruction ProcessingInstruction 7

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

SignificantWhitespace SignificantWhitespace SignificantWhitespace SignificantWhitespace 14

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

Text Text Text Text 3

The text content of a node.

Whitespace Whitespace Whitespace Whitespace 13

White space between markup.

XmlDeclaration XmlDeclaration XmlDeclaration XmlDeclaration 17

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


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