When CMarkup Load Returns false

In CMarkup, when the Load method returns false, it is either because it could not load the file, or the data was not well-formed XML. Quite a number of I/O things might have gone wrong. You can check if GetDoc() returns a non-empty string because if it does then you know the file was loaded but the parser encountered an error. Call GetError() to get a parser error string.

April 18, 2004 Update. In release 6.6 (non-MSXML), after calling Load or Save the GetError() string contains the file error on I/O failure or file size on I/O success. If a conversion between UTF-16 and UTF-8 took place, it will be indicated with a status string such as "BOM + 37626 wide chars to 37626 bytes."

Ultimately you may wish to modify or write your own Load (and Save) to handle the file I/O error handling according to your needs. You can use the code in CMarkup as a starting point.

December 5, 2004 Update. See ReadTextFile and WriteTextFile Utility Functions.

CMarkupMSXML wraps the MSXML load method which I think uses a streamed I/O approach (not necessarily loading the entire file into memory before parsing it), and building an internal node tree to represent the document. Unlike in the CMarkup class, when the CMarkupMSXML Load fails, the GetDoc method will always return an empty string even if the file access was successful.