The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
XmlAttributeCollection::ItemOf Property (Int32)
.NET Framework (current version)
Gets the attribute with the specified index.
Assembly: System.Xml (in System.Xml.dll)
Parameters
- i
-
Type:
System::Int32
The index of the attribute.
| Exception | Condition |
|---|---|
| IndexOutOfRangeException | The index being passed in is out of range. |
This property is a Microsoft extension to the Document Object Model (DOM). It is equivalent to calling XmlNamedNodeMap::Item.
The following example displays all the attributes in the collection.
#using <System.Xml.dll> using namespace System; using namespace System::IO; using namespace System::Xml; int main() { XmlDocument^ doc = gcnew XmlDocument; doc->LoadXml( "<book genre='novel' ISBN='1-861001-57-5'><title>Pride And Prejudice</title></book>" ); //Create an attribute collection. XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; Console::WriteLine( "Display all the attributes in the collection...\r\n" ); for ( int i = 0; i < attrColl->Count; i++ ) { Console::Write( "{0} = ", attrColl[ i ]->Name ); Console::Write( "{0}", attrColl[ i ]->Value ); Console::WriteLine(); } }
Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Available since 10
.NET Framework
Available since 1.1
Show: