MCD_STR GetAttribName( int n ) const;

Update November 20, 2010: Release 11.3 introduced GetNthAttrib which is similar to GetAttribName but also returns the attribute value and is more convenient for looping.

Call GetAttribName to get the attribute name of the zero-based nth attribute of the main position element. If there is no current position, it returns an empty string regardless of n. If the child position element has no nth attribute, it returns an empty string. This is used to query the attributes that an element has. You can loop through beginning at n=0 and incrementing n until it returns an empty string to discover all of the attributes an element has.

Here is an example of getting the first attribute of this small sample document:

<ROOT customcode="35"/>
xml.ResetPos();
xml.FindElem();
str sAttribName = xml.GetAttribName( 0 ); // "customcode"
str sValue = xml.GetAttrib(sAttribName); // "35"

GetAttribName also works when the main position is a processing instruction node. See Node Methods in CMarkup.