MSXML load throws E_ACCESSDENIED

U

upendra.desai

Hi,

I have written an application in Microsoft Visual C++ (Visual Studio
6.0) that uses MSXML 4.0 SP2. When I try to load an XML from a file, it
throws an E_ACCESSDENIED (HRESULT = 0x80070005) exceptioon. I am not
sure why this is happenning. The sample code is:

IXMLDOMDocument2Ptr spXMLDocument;
spXMLDocument.CreateInstance(CLSID_DOMDocument40);

try
{
VARIANT vSourceFile;
VariantInit(&vSourceFile);

vSourceFile.vt = VT_BSTR;
vSourceFile.bstrVal = _bstr_t("C:\\Data.xml");

VARIANT_BOOL vbReturnCode = VARIANT_FALSE;
vbReturnCode = spXMLDocument->load(vSourceFile); //This is
the line that throws the exception.
}
catch(_comk_error &e)
{
AfxMessageBox(e.Description());
}

If I replace the load method with the loadXML method and pass the XML
as a string, it works fine.

I am trying to run this program on a machine with a French version of
WinXP. I tried to use MSXML 6.0 in stead of MSXML 4 and that seems to
have solved the problem. The thing is that we do not want to recompile
and re-release the program with MSXML 6. I am not sure why this fails
with MSXML 4.0.

I have a feeling that this has something to do with access rights but I
could be wrong.

Another problem on the same machine is that IE cannot display the XML
(even though it is well-formed). IE gives a message "XML page cannot be
displayed.......class not registered". I am not sure if these two
problems are related.

Any feedback would be appreciated.

Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top