CMarkup GetError Method

MCD_STR CMarkup::GetError() const;

GetError is called after SetDoc, Load, or Save to get the file I/O or parsing error string. In the following example an ill-formed document is passed to CMarkup.

CMarkup xml( MCD_T("<P>Hello<BR>Hi") );

GetError returns the following string:

start tag 'BR' at offset 8 expecting end tag at offset 14

Update March 24, 2009: With CMarkup release 11.0, you can use GetResult instead of GetError to get a structured markup result string. Actually, GetError is now implemented by processing the result markup in the m_strResult member (but only the first error while the result provides multiple errors). Here is the GetResult for the above ill-formed document:

<unended_start_tag tagname="BR" offset="8" offset2="14"/><unended_start_tag tagname="P" offset="0" offset2="14"/><root_has_sibling/>

You can process the result markup with code such as the following:

CMarkup mResult( xml.GetResult() );
mResult.FindElem( MCD_T("unended_start_tag") );
mResult.FindElem( MCD_T("root_has_sibling") );