System.Xml.XPath.XPathNavigator.HasChildren Property

Gets a value indicating whether the current node has any child nodes.

Syntax

public virtual bool HasChildren { get; }

Value

True if the current node is element and has one or more children; Otherwise False (attribute and namespace nodes don't have "children").

Remarks

If the System.Xml.XPath.XPathNavigator is positioned on a node that cannot have child nodes, the XPathNavigator.HasChildren property always returns false.

The following table lists the child node System.Xml.XPath.XPathNodeType nodes allowed for each System.Xml.XPath.XPathNodeType node.

XPathNodeType.Root

XPathNodeType.Element, XPathNodeType.Comment, or XPathNodeType.ProcessingInstruction nodes.

System.Xml.XmlNodeType.DocumentFragment is equivalent to XPathNodeType.Root when using the System.Xml.XmlDocument class and can have the same children as an element.
XPathNodeType.Element

XPathNodeType.Element, XPathNodeType.Text, XPathNodeType.Comment, XPathNodeType.ProcessingInstruction, XPathNodeType.Whitespace or XPathNodeType.SignificantWhitespace nodes.

All other System.Xml.XPath.XPathNodeType nodes

Cannot have child nodes.

Requirements

Namespace: System.Xml.XPath
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0