XPathNavigator.HasChildren 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个值,该值指示当前节点是否有任何子节点。
public:
virtual property bool HasChildren { bool get(); };
public:
abstract property bool HasChildren { bool get(); };
public virtual bool HasChildren { get; }
public abstract bool HasChildren { get; }
member this.HasChildren : bool
Public Overridable ReadOnly Property HasChildren As Boolean
Public MustOverride ReadOnly Property HasChildren As Boolean
属性值
如果当前节点具有任何子节点,则为 true
;否则为 false
。
注解
XPathNavigator如果定位在不能有子节点的节点上,则HasChildren属性始终返回false
。
下表列出了每个XPathNodeType节点允许的子节点节点XPathNodeType。
XPathNodeType 节点 | 子 XPathNodeType 节点 |
---|---|
Root | Element、节点 Comment或 ProcessingInstruction 节点。 注意: DocumentFragment 与 Root 使用 XmlDocument 类时等效,并且可以具有与元素相同的子级。 |
Element | Element、、Text、Comment或 Whitespace ProcessingInstructionSignificantWhitespace节点。 |
所有其他 XPathNodeType 节点 | 不能有子节点。 |