CMarkup has been used on Windows CE since early in 2001, using the UNICODE build. CMarkup is great there because of its small footprint. But new releases of CMarkup are not tested on Windows CE so there have been small compile issues in some releases.
I think the problem you are describing is related to the saving and loading of files, not the processing. CMarkup
Load may have problems with Win CE because of the wide char (UNICODE UCS-2) files on Win CE. But we can figure this out without too much difficulty. I would look at the flags involved in saving the file, and trace through to make sure the xml
m_csData contains those default structures before it is saved. Also check into any differences between files on the two versions of the OS. UCS-2 has two bytes per character, ASCII is one byte per char, and UTF-8 is one byte per char for standard ASCII chars and more for others. The Save and Load were primarily built for UTF-8 but can be modified for Win CE.
Re: CMarkup not working in WinCE 3.0
Thanh Ly 10-Mar-2003
Good news. It seems to like the C runtime routines over Win32 routines for converting Wide-char strings into single byte strings. In
int nUTF8Len = WideCharToMultiByte(CP_UTF8,0,m_csDoc,nLength,NULL,0,NULL,NULL); char* pBuffer = new char[nUTF8Len+1]; nLength = WideCharToMultiByte(CP_UTF8,0,m_csDoc,nLength,pBuffer,nUTF8Len+1,NULL,NULL); file.Write( pBuffer, nLength ); delete pBuffer;
/* Mod by Thanh Ly 3/10/03 */ int newLen = m_csDoc.GetLength(); char *pBuffer = (char*)LocalAlloc(LPTR,newLen); wcstombs(pBuffer,m_csDoc,newLen); file.Write(pBuffer,newLen); LocalFree(pBuffer);
So instead of calling
WideCharToMultiByte() to do the string conversions, I use
wcstombs() and it works just as well.
Conversion functions were added to CMarkup in developer release 6.6.
Markup 8.2 under Windows CE
I want to use my CMarkup Developer 8.2 under Windows CE. I see you use
errno which is not supported by Embedded Visual C++ 4.0 compiler. Have you done or do you plan to get back Windows CE compatibility by using
FormatMessage()? I remember that I had tested CMarkup 6.5 under Windows CE in the past and it was working perfectly.
Windows CE compatibility with the error string was cleaned up in release 8.3.
strerror was introduced as part of efforts to reduce platform specific dependencies, but
FormatMessage is used when
wcserror is not available. These are suggestions for doing your own fix prior to CMarkup 8.3:
#ifdef _WIN32_WCEat the top of Markup.cpp you can add
#define strerror(n) _T("file error")
errnois supported, you can replace each call to strerror with the error as just a number like
strError.Format( "errno %d", errno );
// OS provides a system error string
DWORD dwError = GetLastError();
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, dwError, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
csDescription.GetBuffer(255), nSize, NULL );
CMarkup release 8.3 has
x_GetLastError which uses the Windows API
GetLastError() when the relevant
wcserror function is not available.
"x_GetSystemError() and use the GetLastError() function"
This would be a nice solution. Please do it.
It is done in CMarkup release 8.3 and the internal function used to get file errors is called
x_GetLastError though there is no affect on the public
Embedded Visual C++ warning LNK1166
I'm testing your CMarkup 8.2 at the moment. When I compile my project with embedded visual c++ (Windows CE) I always get the warning:
Markup.obj : warning LNK1166: cannot adjust code at offset=0x00001000, rva=0x0001CCE4
/Gy compiler option. If the warning remains, based on my googling the warning apparently means it would be necessary to rewrite large functions into multiple smaller ones for the code to work correctly on certain TI 925 chips due to a bug on those chips.
CMarkup not working in WinCE 3.0
Thanh Ly 10-Mar-2003
CMarkup class doesn't seem to be working on PocketPC devices running the older Windows CE 3.0 OS. I'm testing my application on various hardware and OS combinations. The XML functions in my application work as intended on all PocketPCs running PocketPC 2002 OS but not WinCE 3.0 although the hardware platform remains the same. There are no errors when compiling the program, it's simpily exhibiting this unusual behavior at runtime. For a simple test case and example, my application checks to see if there is a data file - which is an XML document - when it starts up and creates one if one does not already exist. The xml file is created but is empty, it does not contain the default XML structure my application was suppose to create.