Mono Class Library: System.Xml.XmlTextReader Overview | Members

System.Xml.XmlTextReader.GetAttribute Method

Returns the value of the attribute with the specified index relative to the containing element. [Edit]

public override string GetAttribute (int i)

Parameters

i
A int specifying the zero-based index of the attribute relative to the containing element. [Edit]

Returns

A string containing the value of the specified attribute. [Edit]

Exceptions

TypeReason
ArgumentOutOfRangeExceptioni is less than 0, or greater than or equal to the XmlTextReader.AttributeCount of the containing element.

Note: XmlTextReader.AttributeCount returns zero for all node types except Attribute, DocumentType, Element, and XmlDeclaration. Therefore, this exception is thrown if the reader is not positioned on one of these node types.

[Edit]

Remarks

This method does not move the reader.

Note: This method overrides XmlReader.GetAttribute(string).

[Edit]

Example

See the XmlTextReader.GetAttribute(int)(String, String) method for an example using all three overloads of this method.

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0