XmlNodeType Enumeration

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Specifies the type of node.

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

type XmlNodeType

Member nameDescription
NoneThis is returned by the XmlReader if a Read method has not been called.
ElementAn element (for example, <item> ).

An Element node can have the following child node types: Element, Text, Comment, ProcessingInstruction, CDATA, and EntityReference. It can be the child of the Document, DocumentFragment, EntityReference, and Element nodes.

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

An Attribute node can have the following child node types: Text and EntityReference. The Attribute node does not appear as the child node of any other node type. It is not considered a child node of an Element.

TextThe 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.

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

CDATA sections are used to escape blocks of text that would otherwise be recognized as markup. A CDATA node cannot have any child nodes. It can appear as the child of the DocumentFragment, EntityReference, and Element nodes.

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

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

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

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

WhitespaceWhite space between markup.
SignificantWhitespaceWhite space between markup in a mixed content model or white space within the xml:space="preserve" scope.
EndElementAn end element tag (for example, </item> ).

EndElement nodes are returned when XmlReader gets to the end of an element.

XmlDeclarationThe 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.

Show: