CMarkup GetAttrib Method

MCD_STR CMarkup::GetAttrib( MCD_CSTR szAttrib ) const;

Call GetAttrib to get the string value of the attribute named szAttrib in the main position element. If there is no current position, it returns an empty string. If the main position element has no attribute by the name of sAttribName, it returns an empty string.

This returns the same string passed to the SetAttrib method even if Standard Special Characters are encoded in the markup document itself, i.e. GetAttrib unescapes the escaped characters.

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

To know whether the attribute exists, in the developer version you can call HasAttrib.

Update November 20, 2010: With release 11.3 CMarkup has document flags to trim whitespace and collapse whitespace which will affect the value returned by GetAttrib (see Whitespace and CMarkup).