CMarkup AddNode Method

bool CMarkup::AddNode( int nNodeType, MCD_CSTR szText );

The AddNode method is called to add a node after the main position. If there is no main position, the node is added as the last node under the current parent position element. After a node is successfully added, the main position points to the new node.

The szText argument has a different purpose for the different types of nodes. For a Comment, this text is the text of the comment; for a Document Type, it is the entire DTD from beginning < to ending >; for a Processing Instruction, its the target (such as "xml"); for a Text or CDATA Section, its the text.

This example shows how to add a comment node.

CMarkup xml;
xml.AddNode( CMarkup::MNT_COMMENT, "hello" );

Update March 24, 2009: AddNode can be used with CMarkup release 11.0 developer version file write mode (see C++ XML writer).

See the Node Methods in CMarkup.