XPathNavigator.MoveToChild 方法

定义

XPathNavigator 移动到指定的子节点。Moves the XPathNavigator to the child node specified.

重载

MoveToChild(XPathNodeType)

XPathNavigator 移动到指定的 XPathNodeType 的子节点。Moves the XPathNavigator to the child node of the XPathNodeType specified.

MoveToChild(String, String)

XPathNavigator 移动到具有指定的本地名称和命名空间 URI 的子节点。Moves the XPathNavigator to the child node with the local name and namespace URI specified.

MoveToChild(XPathNodeType)

XPathNavigator 移动到指定的 XPathNodeType 的子节点。Moves the XPathNavigator to the child node of the XPathNodeType specified.

public:
 virtual bool MoveToChild(System::Xml::XPath::XPathNodeType type);
public virtual bool MoveToChild (System.Xml.XPath.XPathNodeType type);
abstract member MoveToChild : System.Xml.XPath.XPathNodeType -> bool
override this.MoveToChild : System.Xml.XPath.XPathNodeType -> bool
Public Overridable Function MoveToChild (type As XPathNodeType) As Boolean

参数

type
XPathNodeType

要移动到的子节点的 XPathNodeTypeThe XPathNodeType of the child node to move to.

返回

Boolean

如果 XPathNavigator 成功地移动到此子节点,则为 true;否则为 falsetrue if the XPathNavigator is successful moving to the child node; otherwise, false. 如果为 false,则 XPathNavigator 的位置不变。If false, the position of the XPathNavigator is unchanged.

注解

方法的返回值 MoveToChild 取决于 XPathNodeType 当前节点的,以及 XPathNodeType 要移动到的子节点的。The return value of the MoveToChild method depends on the XPathNodeType of the current node, and the XPathNodeType of the child node to move to.

下表显示了不同的 XPathNodeType 节点以及它们可以移动到的子节点。The following table shows the different XPathNodeType nodes, and the child nodes they can move to.

当前节点的 XPathNodeTypeCurrent Node's XPathNodeType 子节点的 XPathNodeTypeChild Node's XPathNodeType
Root ElementProcessingInstructionCommentTextElement, ProcessingInstruction, Comment, or Text.
Element ElementProcessingInstructionCommentTextElement, ProcessingInstruction, Comment, or Text.
所有其他 XPathNodeTypeAll other XPathNodeType values 无。None.

适用于

MoveToChild(String, String)

XPathNavigator 移动到具有指定的本地名称和命名空间 URI 的子节点。Moves the XPathNavigator to the child node with the local name and namespace URI specified.

public:
 virtual bool MoveToChild(System::String ^ localName, System::String ^ namespaceURI);
public virtual bool MoveToChild (string localName, string namespaceURI);
abstract member MoveToChild : string * string -> bool
override this.MoveToChild : string * string -> bool
Public Overridable Function MoveToChild (localName As String, namespaceURI As String) As Boolean

参数

localName
String

要移动到的子节点的本地名称。The local name of the child node to move to.

namespaceURI
String

要移动到的子节点的命名空间 URI。The namespace URI of the child node to move to.

返回

Boolean

如果 XPathNavigator 成功地移动到此子节点,则为 true;否则为 falsetrue if the XPathNavigator is successful moving to the child node; otherwise, false. 如果为 false,则 XPathNavigator 的位置不变。If false, the position of the XPathNavigator is unchanged.

示例

有关方法的示例 MoveToChild ,请参见 AppendChild 方法。For an example of the MoveToChild method, see the AppendChild method.

适用于