This documentation is archived and is not being maintained.

XPathNavigator.MoveToAttribute Method

Moves to the attribute with matching LocalName and NamespaceURI.

[Visual Basic]
Public MustOverride Function MoveToAttribute( _
   ByVal localName As String, _
   ByVal namespaceURI As String _
) As Boolean
public abstract bool MoveToAttribute(
 string localName,
 string namespaceURI
public: virtual bool MoveToAttribute(
 String* localName,
 String* namespaceURI
) = 0;
public abstract function MoveToAttribute(
   localName : String,
 namespaceURI : String
) : Boolean;


The local name of the attribute.
The namespace URI of the attribute. If this is a null reference (Nothing in Visual Basic), an empty namespace is assumed.

Return Value

true if the attribute is found; otherwise, false. If false, the position of the navigator does not change.


If the navigator is not currently positioned on an element, this method returns false.

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

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


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

XPathNavigator Class | XPathNavigator Members | System.Xml.XPath Namespace | MoveToFirstAttribute | MoveToNextAttribute | GetAttribute