CMarkup SetDocFlags Method
void CMarkup::SetDocFlags( int nFlags );
SetDocFlags sets the flags that pertain to the entire document object, and GetDocFlags gets them.
File encoding and BOM flags
Update December 17, 2008: With the new CMarkup release 10.1 file I/O features, there is the additional
MDF_UTF16BEFILE flag, and now all the BOM handling and file encoding conversion is available in the Evaluation version of CMarkup.
MDF_UTF16BEFILE bit is on, the file that the document is saved to or loaded from is encoded in UTF-16. UTF-16LE (little endian) is the default on Windows. See UTF-16 Files and the Byte Order Mark (BOM).
MDF_UTF8PREAMBLE bit is set when a 3-byte UTF-8 preamble (BOM) is used in the file. This flag is set on reading a file which has a UTF-8 preamble. The 3-byte preamble itself is not kept in the document in memory, it is only in the file. The flag can also be set to force a preamble to be used when the file is saved to UTF-8. See UTF-8 Files and the Preamble.
When setting a flag bit during the course of the lifespan of the CMarkup object, you should be careful to only modify the specific bit you want to set unless you know you want to clear any other bits. Here is some code to turn a bit on or off without affecting other bits:
xml.SetDocFlags( xml.GetDocFlags() | xml.MDF_UTF8PREAMBLE ); // on xml.SetDocFlags( xml.GetDocFlags() & ~xml.MDF_UTF8PREAMBLE ); // off
Trim whitespace and collapse whitespace
Ignore case for non-compliant markup
MDF_IGNORECASE bit controls whether CMarkup is case sensitive when finding element tag names and attribute names. The
MDF_IGNORECASE flag is usually set when the CMarkup object is instantiated, before the HTML is loaded and parsed. It also affects navigation. See HTML And CMarkup.
CMarkup html; html.SetDocFlags( CMarkup::MDF_IGNORECASE ); html.Load( "example.html" );
Modified document flag
MDF_MODIFIED bit indicates whether the document has been modified, like a "dirty" indicator. CMarkup sets this bit whenever the document content itself is modified. You usually get this flag with GetDocFlags, rather than setting it.