Editar

Partilhar via


XmlNodeType Enum

Definition

Specifies the type of node.

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

Fields

Name Value Description
None 0

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

Element 1

An element (for example, <item> ).

Attribute 2

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

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.

CDATA 4

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

EntityReference 5

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

Entity 6

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

ProcessingInstruction 7

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

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.

DocumentType 10

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

DocumentFragment 11

A document fragment.

Notation 12

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

Whitespace 13

White space between markup.

SignificantWhitespace 14

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

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().

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.

Remarks

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.
EndEntity
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
None
Notation None DocumentType
ProcessingInstruction None Document, DocumentFragment, Element, EntityReference
SignificantWhitespace
Text None Attribute, DocumentFragment, Element, EntityReference
Whitespace
XmlDeclaration Must be the first node in the document. It can have attributes that provide version and encoding information. None Document

Applies to