CMarkup Open Method
Open to open the file for read or write mode with one of the following flags:
|file read mode||C++ XML reader|
|file write mode||C++ XML writer|
CMarkup xml; bool bSuccess = xml.Open( "C:\\Temp\\largexmlfile.xml", CMarkup::MDF_READFILE );
Open is called when the object has been populated in regular mode, the in-memory document is discarded. CMarkup's
m_strDoc string member is used as an in-memory partial document buffer in both file modes like a window into a portion of the document while reading or writing.
true if the file is successfully opened according to the value of
false, the error string can be retrieved with GetError.
When opening a file in write mode you can combine (logical OR) the encoding/BOM bit flags into the
nDocFlags argument, or set them with the SetDocFlags method beforehand.
|UTF-16LE encoding (BOM is always included)|
|UTF-16BE encoding (BOM is always included)|
|use UTF-8 preamble (also called BOM)|
In file read mode, you can determine whether the file was UTF-16 or had a UTF-8 preamble by calling the GetDocFlags method after
pstrEncoding argument can be specified for either mode. For write mode you can specify the ANSI or double-byte encoding to be used. For read mode it will return the ANSI or double-byte encoding name that was determined.
MDF_APPENDFILE functionality is limited to documents without a root element. It does not parse the file so it does not know the context to which it is appending markup data.