XPathNavigator.MoveToParent 方法

当在派生类中被重写时,将 XPathNavigator 移动到当前节点的父节点。

**命名空间:**System.Xml.XPath
**程序集:**System.Xml(在 system.xml.dll 中)

语法

声明
Public MustOverride Function MoveToParent As Boolean
用法
Dim instance As XPathNavigator
Dim returnValue As Boolean

returnValue = instance.MoveToParent
public abstract bool MoveToParent ()
public:
virtual bool MoveToParent () abstract
public abstract boolean MoveToParent ()
public abstract function MoveToParent () : boolean

返回值

如果 XPathNavigator 成功地移动到当前节点的父节点,则返回 true;否则返回 false。如果为 false,则 XPathNavigator 的位置将保持不变。

备注

MoveToParent 方法的返回值取决于当前节点的 XPathNodeType 及要移动到的父节点的 XPathNodeType

下表显示了不同的 XPathNodeType 节点及它们可以移动到的父节点。

XPathNodeType

父节点

Root

Root 节点没有父节点。

Element

ElementRoot 节点。

Attribute

Element 节点。

Text

Element 节点。

Namespace

Element 节点。

ProcessingInstruction

ElementRoot 节点。

Comment

ElementRoot 节点。

Whitespace

ElementRoot 节点。

SignificantWhitespace

ElementRoot 节点。

示例

有关 MoveToParent 方法的示例,请参见 CreateAttribute 方法。

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

XPathNavigator 类
XPathNavigator 成员
System.Xml.XPath 命名空间