Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Problem : loading XML-File to IXMLDocument

From: "Alex Krawarik [MSFT]" <alexkr@------.---------.--->
To: 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
> 




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent