CMarkup GetDocFlags Method

int CMarkup::GetDocFlags() const;

The GetDocFlags method returns the flags that pertain to the entire document object. See also the SetDocFlags method.

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.

If the MDF_UTF16LEFILE or MDF_UTF16BEFILE bit is on, the file that the document was loaded from (or will be save to) is encoded in UTF-16. UTF-16LE (little endian) is the default on Windows. See UTF-16 Files and the Byte Order Mark (BOM).

The 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 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.

Trim whitespace and collapse whitespace

Update November 20, 2010: CMarkup release 11.3 introduces MDF_TRIMWHITESPACE and MDF_COLLAPSEWHITESPACE document flags (see Whitespace and CMarkup). GetDocFlags can be used to query whether or not these flags are set, for example:

if ( xml.GetDocFlags() & CMarkup::MDF_TRIMWHITESPACE )
  // then we know whitespace trimming is on...

Ignore case for non-compliant markup

The MDF_IGNORECASE bit controls whether CMarkup is case sensitive when finding element tag names and attribute names. See Generic Markup In CMarkup.

Modified document flag

CMarkup Developer License

The MDF_MODIFIED flag described below is only in CMarkup Developer and the free XML editor  FOAL C++ scripting.

The 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.

File mode flags

CMarkup Developer License

File modes are only supported in CMarkup Developer.

Update March 24, 2009: CMarkup release 11.0 developer version file read mode (see C++ XML reader) and file write mode (see C++ XML writer) keep a file open between method calls.

You cannot set the three file mode flags directly as they are commenced with Open and ended with Close, but you can retrieve them with GetDocFlags. They are MDF_READFILE, MDF_WRITEFILE and MDF_APPENDFILE. This allows you to determine if the CMarkup object is in file mode, and which file mode. In append mode, both the write and append flag bits will be on.