CMarkup Load Method

bool CMarkup::Load( MCD_CSTR szFileName );

Call Load to read the document from a file. For example:

CMarkup xml;
bool bSuccess = xml.Load( "C:\\Temp\\hello.xml" );

It returns true if the file is successfully loaded and determined to be well-formed as explained in the SetDoc method. If the file is not accessible or empty then the CMarkup object is empty. If the read is successful, the CMarkup object contains the content of the file whether or not it is well-formed.

If Load returns false, the result can be retrieved with GetResult. See also When CMarkup Load Returns false.

After Load, you can call GetDoc to get the loaded document content as a string.

The Load method calls the ReadTextFile function and retrieves any resulting flags to the CMarkup document's flags. So, after calling Load you can check if it was a UTF-16 file or there was a UTF-8 BOM (see GetDocFlags). These flags are maintained in the CMarkup object so that if the file saved later, it will be written the same way.

Update December 17, 2008: With CMarkup release 10.1, the Load and Save methods, and the underlying ReadTextFile and WriteTextFile functions have greatly expanded character conversion capabilities. Load will now decode the file according to the ANSI or double-byte encoding specified in the XML declaration or HTML Content-Type meta tag (see GetDeclaredEncoding).