XPathNavigator.GetAttribute Method (String, String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the value of the attribute with the specified local name and namespace URI.

Namespace:   System.Xml.XPath
Assembly:  System.Xml (in System.Xml.dll)

public virtual string GetAttribute(
	string localName,
	string namespaceURI


Type: System.String

The local name of the attribute. localName is case-sensitive.

Type: System.String

The namespace URI of the attribute.

Return Value

Type: System.String

A String that contains the value of the specified attribute; String.Empty if a matching attribute is not found, or if the XPathNavigator is not positioned on an element node.

The XPathNavigator must be positioned on an element node before calling the GetAttribute method.

This method has no effect on the state of the XPathNavigator.

.NET Framework
Available since 1.1
Available since 4.0
Return to top