Share via


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)

Syntax

'Declaration
Public Enumeration XmlNodeType
public enum XmlNodeType
public enum class XmlNodeType
type XmlNodeType
public enum XmlNodeType

Members

Member name Description
None This is returned by the XmlReader if a Read method has not been called.
Element An 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.

Attribute An 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.

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

CDATA A 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.

ProcessingInstruction A 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.

Comment A 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.

Whitespace White space between markup.
SignificantWhitespace White space between markup in a mixed content model or white space within the xml:space="preserve" scope.
EndElement An end element tag (for example, </item> ).

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

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

See Also

Reference

System.Xml Namespace