Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: IXMLDOMDocument::load fails on Windows Mobile IXMLDOMDocument::load fails on Windows MobileTo: NULL Date: 11/19/2009 3:55:00 PM
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);
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
