![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Problem : loading XML-File to IXMLDocument >Thread Next - Re: Problem : loading XML-File to IXMLDocument Re: Problem : loading XML-File to IXMLDocumentTo: NULL Date: 2/2/2007 9:43:00 AM
What is the number of the exception you are getting, please?
<dominik.erni@g...> 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 | |||||
|
