The load() method of an IXMLDOMDocumentPtr object fails reading an XML text file containing an explicit end-of-file character (^Z). This could happen if the file was copied using "copy /a src.xml result.xml". When reading "result.xml", the load() method will fail with the following error:
An invalid character was found in text content.
It's possible to avoid this problem by opening the file in text mode (e.g. using fopen(..., "rt")), reading the file's content into a buffer, and use the loadXML() method on this buffer, but I'd prefer to avoid the memory allocation.
- Is there a way to specify text mode (instead of binary mode) for the load() method?
- Is it possible to open a file stream from the program (e.g. FILE* or std::istream) and let the XML parser use the right functions for reading text from that stream?