bool CMarkup::SetChildAttrib( MCD_CSTR szAttrib, MCD_CSTR szValue, int nFlags = 0 );
bool CMarkup::SetChildAttrib( MCD_CSTR szAttrib, int nValue, int nFlags = 0 );

Calling SetChildAttrib adds or changes the attribute named szAttrib in the child position element to have the specified value (see SetAttrib to modify main position attributes). If the attribute already exists for the child position element, the value is changed. Otherwise the attribute and its value are added. The method returns false if there is no child position element.

Update September 27, 2008: In CMarkup release 10.0 you can specify MNF_WITHREFS in the optional nFlags argument to set an attribute value with numeric character references or entities. This tells CMarkup not to double escape ampersands that are followed by an entity name or numeric character reference and semi-colon. Here is an example setting the attribute with an escaped ampersand in the href attribute of an HTML hyperlink.

html.SetChildAttrib( "href",
  "http://example.com/?a=1&b=2", CMarkup::MNF_WITHREFS );

The AddChildAttrib method is no longer used and was the same as SetChildAttrib. The term "Add" is misleading because an element can only have one attribute of a given name.