System.Xml.XPath.XPathNavigator.MoveToAttribute Method

Moves the System.Xml.XPath.XPathNavigator to the attribute with the matching local name and namespace URI.

Syntax

public virtual bool MoveToAttribute (string localName, string namespaceURI)

Parameters

localName
The local name of the attribute.
namespaceURI
The namespace URI of the attribute; null for an empty namespace.

Returns

Returns true if the System.Xml.XPath.XPathNavigator is successful moving to the attribute; otherwise, false. If false, the position of the System.Xml.XPath.XPathNavigator is unchanged.

Remarks

If the System.Xml.XPath.XPathNavigator is not currently positioned on an element, this method returns false.

After a successful call to XPathNavigator.MoveToAttribute(string, string), the XPathNavigator.LocalName, XPathNavigator.NamespaceURI and XPathNavigator.Prefix properties reflect the values of the attribute. When the System.Xml.XPath.XPathNavigator is positioned on an attribute, the methods XPathNavigator.MoveToNext, XPathNavigator.MoveToPrevious, and XPathNavigator.MoveToFirst are not applicable. These methods always return false and do not change the position of the navigator. Rather, you can call XPathNavigator.MoveToNextAttribute to move to the next attribute node.

Once positioned on an attribute, you can call XPathNavigator.MoveToParent to move to the owner element.

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