XmlNodeType 枚举

定义

指定节点的类型。

C#
public enum XmlNodeType
继承
XmlNodeType

字段

Attribute 2

特性(例如,id='123')。

CDATA 4

CDATA 部分(例如,<![CDATA[my escaped text]]>)。

Comment 8

注释(例如,<!-- my comment -->)。

Document 9

作为文档树的根的文档对象提供对整个 XML 文档的访问。

DocumentFragment 11

文档片段。

DocumentType 10

由以下标记指示的文档类型声明(例如,<!DOCTYPE...>)。

Element 1

元素(例如,<item>)。

EndElement 15

末尾元素标记(例如,</item>)。

EndEntity 16

由于调用 ResolveEntity() 而使 XmlReader 到达实体替换的末尾时返回。

Entity 6

实体声明(例如,<!ENTITY...>)。

EntityReference 5

实体引用(例如,&num;)。

None 0

如果未调用 Read 方法,则由 XmlReader 返回。

Notation 12

文档类型声明中的表示法(例如,<!NOTATION...>)。

ProcessingInstruction 7

处理指令(例如,<?pi test?>)。

SignificantWhitespace 14

混合内容模型中标记间的空格或 xml:space="preserve" 范围内的空格。

Text 3

节点的文本内容。

Text 节点不能具有任何子节点。 它可以显示为 AttributeDocumentFragmentElementEntityReference 节点的子节点。

Whitespace 13

标记间的空白。

XmlDeclaration 17

XML 声明(例如,<?xml version='1.0'?>)。

XmlDeclaration 节点必须是文档中的第一个节点。 它不能有子节点。 它是 Document 节点的子节点。 它可以具有提供版本和编码信息的属性。

注解

下表提供有关 XML 节点及其父节点和子节点的其他信息。

字段 描述 可以具有子节点: 可以是以下项的子节点:
Attribute EntityReference, Text 无。 它不被视为子 Element节点。
CDATA CDATA 节用于转义文本块,否则这些文本块会被识别为标记。 无。 DocumentFragmentEntityReferenceElement
Comment 无。 DocumentDocumentFragmentEntityReference
Document XmlDeclarationElement (最多一个) 、ProcessingInstruction、、 Comment``DocumentType
DocumentFragment 将节点或子树与文档关联,而不实际包含在文档中。 ElementProcessingInstructionCommentTextCDATAEntityReference 无。
DocumentType Notation, Entity
Element ElementTextCommentProcessingInstructionCDATAEntityReference DocumentDocumentFragmentEntityReferenceElement
EndElement 当获取到元素的末尾时 XmlReader 返回。
EndEntity
Entity 例如 Text ,表示扩展实体的子节点 (,节点 EntityReference) DocumentType
EntityReference ElementProcessingInstructionCommentTextCDATAEntityReference AttributeDocumentFragmentElementEntityReference
None
Notation None DocumentType
ProcessingInstruction None DocumentDocumentFragmentElementEntityReference
SignificantWhitespace
Text None AttributeDocumentFragmentElementEntityReference
Whitespace
XmlDeclaration 必须是文档中的第一个节点。 它可以具有提供版本和编码信息的属性。 Document

适用于

产品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0