XmlNode(2)
时间:2010-10-13 来源:Jessica Lu
接1,下表是不同的XmlNode类型返回的不同的XmlNode的Value。
NodeType
说明
Value
Attribute
属性(例如,id='123')。
Attribute 节点可以具有以下子节点类型:Text 和 EntityReference。Attribute 节点不以任何其他节点类型子节点的形式出现。不将其视为 Element 的子节点。
Comment
注释(例如,<!-- my comment -->)。
Comment 节点不能有任何子节点。它可以以 Document、DocumentFragment、Element 和 EntityReference 节点子级的形式出现。
注释的内容。
Document
作为文档树的根的文档对象提供对整个 XML 文档的访问。
Document 节点可以具有以下子节点类型:XmlDeclaration、Element(最多一个)、ProcessingInstruction、Comment 和 DocumentType。它不能以任何节点类型子级的形式出现。
空引用(在 Visual Basic 中为 Nothing).
DocumentFragment
文档片段。
DocumentFragment 节点将节点或子树与文档关联起来,而实际上并不包含在该文档中。DocumentFragment 节点可以具有以下子节点类型:Element、ProcessingInstruction、Comment、Text、CDATA 和 EntityReference。它不能以任何节点类型子级的形式出现。
空引用(在 Visual Basic 中为 Nothing).
DocumentType
由以下标记指示的文档类型声明(例如,<!DOCTYPE...>)。
DocumentType 节点可以具有以下子节点类型:Notation 和 Entity。它可以以 Document 节点子级的形式出现。
空引用(在 Visual Basic 中为 Nothing).
Element
元素(例如,<item>)。
Element 节点可以具有以下子节点类型:Element、Text、Comment、ProcessingInstruction、CDATA 和 EntityReference。它可以是 Document、DocumentFragment、EntityReference 和 Element 节点的子级。
空引用(在 Visual Basic 中为 Nothing)。可使用 XmlElement.InnerText 或 XmlElement.InnerXml 属性访问元素节点的值。
NodeType
说明
Value
Attribute
属性(例如,id='123')。
Attribute 节点可以具有以下子节点类型:Text 和 EntityReference。Attribute 节点不以任何其他节点类型子节点的形式出现。不将其视为 Element 的子节点。
Comment
注释(例如,<!-- my comment -->)。
Comment 节点不能有任何子节点。它可以以 Document、DocumentFragment、Element 和 EntityReference 节点子级的形式出现。
注释的内容。
Document
作为文档树的根的文档对象提供对整个 XML 文档的访问。
Document 节点可以具有以下子节点类型:XmlDeclaration、Element(最多一个)、ProcessingInstruction、Comment 和 DocumentType。它不能以任何节点类型子级的形式出现。
空引用(在 Visual Basic 中为 Nothing).
DocumentFragment
文档片段。
DocumentFragment 节点将节点或子树与文档关联起来,而实际上并不包含在该文档中。DocumentFragment 节点可以具有以下子节点类型:Element、ProcessingInstruction、Comment、Text、CDATA 和 EntityReference。它不能以任何节点类型子级的形式出现。
空引用(在 Visual Basic 中为 Nothing).
DocumentType
由以下标记指示的文档类型声明(例如,<!DOCTYPE...>)。
DocumentType 节点可以具有以下子节点类型:Notation 和 Entity。它可以以 Document 节点子级的形式出现。
空引用(在 Visual Basic 中为 Nothing).
Element
元素(例如,<item>)。
Element 节点可以具有以下子节点类型:Element、Text、Comment、ProcessingInstruction、CDATA 和 EntityReference。它可以是 Document、DocumentFragment、EntityReference 和 Element 节点的子级。
空引用(在 Visual Basic 中为 Nothing)。可使用 XmlElement.InnerText 或 XmlElement.InnerXml 属性访问元素节点的值。
相关阅读 更多 +