Windows apps
Collapse the table of content
Expand the table of content
Information
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.

XmlAttribute::Name Property

 

Gets the qualified name of the node.

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

public:
property String^ Name {
	virtual String^ get() override;
}

Property Value

Type: System::String^

The qualified name of the attribute node.

The following example displays information on each of the nodes in the attribute 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 xmlns:bk='urn:samples' bk:genre='novel'><title>Pride And Prejudice</title></book>" );

   //Create an attribute collection.
   XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes;
   Console::WriteLine( "Display information on each of the attributes... \r\n" );
   System::Collections::IEnumerator^ myEnum = attrColl->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      XmlAttribute^ attr = safe_cast<XmlAttribute^>(myEnum->Current);
      Console::Write( "{0} = {1}", attr->Name, attr->Value );
      Console::WriteLine( "\t namespaceURI={0}", attr->NamespaceURI );
   }
}

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft