![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Problem : loading XML-File to IXMLDocument [Thread Next] Re: Problem : loading XML-File to IXMLDocumentTo: NULL Date: 2/5/2007 11:03:00 PM
I found he error:
The file was supposed to be encoded in utf-16, but appearently it
wasn't...
On 5 Feb., 08:15, "dominik.e...@gmail.com" <dominik.e...@gmail.com>
wrote:
> I get the following exception:
>
> An Exception (first chance) at 0x7c812a5b in bwa.exe: 0xE0000001:
> 0xe0000001
>
> On 2 Feb., 18:42, "Alex Krawarik [MSFT]" <ale...@online.microsoft.com>
> wrote:
>
> > What is the number of the exception you are getting, please?
>
> > <dominik.e...@gmail.com> wrote in message
>
> >news:1170435816.946399.140760@q......
>
> > >I have a strange problem and am loosing my nerves soon:
>
> > > I want to read the content from a file with XML structure to a
> > > IXMLDocument object. Goal is to read the configuration files of the
> > > new WindowsMail which are in XML format. If I open such a file, I have
> > > no problems. But if I manually create such a file with an editor and
> > > copy the content of the existing file into it and use my method on
> > > this manually created file, I get an exception! (both files have the
> > > same content!)
>
> > > Here's the code:
>
> > > IXMLDocument* WindowsMailConfigFile::createXMLObject(CString path) {
>
> > > IXMLDocument *pDoc = NULL;
>
> > > IStream *pStm = NULL;
>
> > > IPersistStreamInit *pPSI = NULL;
>
> > > CHAR buf[MAX_PATH];
>
> > > CHAR *pszURL;
>
> > > HRESULT hr;
>
> > > pszURL = buf;
>
> > > GetFullPathName(path, MAX_PATH, pszURL, NULL);
>
> > > hr = CoInitialize(NULL);
>
> > > ASSERT(SUCCEEDED(hr));
>
> > > hr = CoCreateInstance(CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER,
>
> > > IID_IXMLDocument, (void**)&pDoc);
>
> > > CHECK_ERROR (pDoc, "CoCreateInstance Failed");
>
> > > // Synchronously create a stream on a URL.
>
> > > hr = URLOpenBlockingStream(0, pszURL, &pStm, 0,0);
>
> > > // Get the IPersistStreamInit interface to the XML doc.
>
> > > hr = pDoc->QueryInterface(IID_IPersistStreamInit, (void **)&pPSI);
>
> > > hr = pPSI->Load(pStm);
>
> > > return pDoc;
>
> > > }
>
> > > On the second last line, the pPSI->Load(pStm) statement seems to throw
> > > an exception somehere else which I cannot catch!
>
> > > This only happens if I use the method on a file which I manually
> > > created! If I use it on an existing config file of WindowsVista, it
> > > works!
>
> > > Can anyone see the problem?
>
> > > Please, I am desperate...
>
> > > Thanks,
>
> > > Dominik
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
