NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DocumentNavigator.GetAttribute (String, String)

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

[Visual Basic]
Overloads Overrides Public Function GetAttribute( _
   ByVal localName As String, _
   ByVal namespaceURI As String _
) As String
[C#]
public override string GetAttribute(
   string localName,
   string namespaceURI
);
[C++]
public: override String* GetAttribute(
   String* localName,
   String* namespaceURI
);
[JScript]
public override function GetAttribute(
   localName : String,
   namespaceURI : String
) : String;

Parameters

localName
The name of the attribute.
namespaceURI
The URN of the namespace of the attribute.

Return Value

The value of the specified attribute.

Exceptions

Exception Type Condition
ArgumentException The attribute specified by localName and namespaceURI properties cannot be found in the current node.

Remarks

The following XML contains an attribute in a specific namespace:

<test xmlns:dt="urn:datatypes" dt:type="int"/>

You can lookup the dt:type attribute using one argument (using Prefix+LocalName) or using two arguments (LocalName and NamespaceURI):

String dt = reader.GetAttribute("dt:type");

String dt2 = reader.GetAttribute("type","urn:datatypes");

Note that the xmlns attributes have no namespace URI; therefore, the only way to look them up is with the short version

String dt3 = reader.GetAttribute("xmlns:dt");

You can also get this information using the Prefix property.

See Also

DocumentNavigator Class | DocumentNavigator Members | System.NewXml Namespace | DocumentNavigator.GetAttribute Overload List