Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IXMLDOMDocument::load fails on Windows Mobile

5 views
Skip to first unread message

Waleri Todorov

unread,
Nov 19, 2009, 8:54:51 AM11/19/09
to

I am trying to load a XML document from an IStream.
The code belows works fine on WIN32 but fails on Windows Mobile.
File is OK, returned stream is OK (I can read from it) but the load() on the
last line always fail.
Reported error is "invalid character" but IXMLDOMParseError doesn't give me
any valid line/pos/filepos
Furthermore, I tried to create a document manually (creating and adding
nodes) then save it to an IStream, then rewind the stream and pass it to
load() it also fails (same error).

Here is the code:

CoInitializeEx(0,COINIT_MULTITHREADED);
HRESULT rv;

HANDLE hFile =
CreateFile(XML_FILE,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,0);
DWORD dwSize = GetFileSize(hFile,NULL);
HGLOBAL hGlobal = GlobalAlloc(GMEM_FIXED,dwSize);
ReadFile(hFile,hGlobal,dwSize,&dwSize,NULL);

IStream* pStream;
CreateStreamOnHGlobal(hGlobal,TRUE,&pStream);

IXMLDOMDocument* pDocument;
rv =
CoCreateInstance(CLSID_DOMDocument,NULL,CLSCTX_INPROC,IID_IXMLDOMDocument,(void**)
&pDocument);
pDocument->put_async(VARIANT_FALSE);

VARIANT var = { 0 };
var.vt = VT_UNKNOWN;
var.punkVal = pStream;

VARIANT_BOOL err;
rv = pDocument->load(var,&err);


Martin Honnen

unread,
Nov 19, 2009, 9:14:08 AM11/19/09
to

Waleri Todorov wrote:
> I am trying to load a XML document from an IStream.
> The code belows works fine on WIN32 but fails on Windows Mobile.

I don't know the answer, you might want to post in
http://social.msdn.microsoft.com/Forums/en-US/msxml/threads/
as some Microsoft employees are answering questions there so your
chances to get a qualified answer are higher there than in this newsgroup.

--

Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/

0 new messages