XPathNavigator.MoveToAttribute(String, String) 方法
定义
将 XPathNavigator 移动到具有匹配的本地名称和命名空间 URI 的属性上。Moves the XPathNavigator to the attribute with the matching local name and namespace URI.
public:
virtual bool MoveToAttribute(System::String ^ localName, System::String ^ namespaceURI);
public:
abstract bool MoveToAttribute(System::String ^ localName, System::String ^ namespaceURI);
public virtual bool MoveToAttribute (string localName, string namespaceURI);
public abstract bool MoveToAttribute (string localName, string namespaceURI);
abstract member MoveToAttribute : string * string -> bool
override this.MoveToAttribute : string * string -> bool
abstract member MoveToAttribute : string * string -> bool
Public Overridable Function MoveToAttribute (localName As String, namespaceURI As String) As Boolean
Public MustOverride Function MoveToAttribute (localName As String, namespaceURI As String) As Boolean
参数
- localName
- String
属性的本地名称。The local name of the attribute.
- namespaceURI
- String
属性的命名空间 URI;对于空命名空间,为 null。The namespace URI of the attribute; null for an empty namespace.
返回
如果 XPathNavigator 成功地移动到此属性,则为 true;否则为 false。true if the XPathNavigator is successful moving to the attribute; otherwise, false. 如果为 false,则 XPathNavigator 的位置不变。If false, the position of the XPathNavigator is unchanged.
注解
如果 XPathNavigator 当前未定位在元素上,此方法将返回 false 。If the XPathNavigator is not currently positioned on an element, this method returns false.
成功调用后, MoveToAttribute LocalName NamespaceURI 和 Prefix 属性反映特性的值。After a successful call to MoveToAttribute, the LocalName, NamespaceURI and Prefix properties reflect the values of the attribute. 当 XPathNavigator 定位在某一特性上时,方法 MoveToNext 、 MoveToPrevious 和 MoveToFirst 不适用。When the XPathNavigator is positioned on an attribute, the methods MoveToNext, MoveToPrevious, and MoveToFirst are not applicable. 这些方法始终返回 false ,不会更改导航器的位置。These methods always return false and do not change the position of the navigator. 相反,您可以调用 MoveToNextAttribute 来移到下一个属性节点。Rather, you can call MoveToNextAttribute to move to the next attribute node.
定位到属性后,可以调用 MoveToParent 移动到 owner 元素。Once positioned on an attribute, you can call MoveToParent to move to the owner element.