Wednesday, December 27, 2023

EOleException: Microsoft MSXML is not installed when calling LoadXMLDocument

EOleException: Microsoft MSXML is not installed when calling LoadXMLDocument

LoadXMLDocument returns IXMLDocument which by default uses MSXML on Windows. MSXML is a COM componet which requires client to initialize COM library. Below shows a bare bones Delphi 11.3 console application initializing COM library.
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
ActiveX,
ComObj,
System.SysUtils,
Xml.XMLDoc,
Xml.XMLIntf;
var
XmlDoc: IXMLDocument;
begin
try
try
CoInitializeEx(nil,
ActiveX.COINIT_MULTITHREADED
);
XmlDoc := LoadXMLDocument('test.xml');
XmlDoc._Release;
XmlDoc := nil;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
finally
CoUninitialize;
end;
end.
view raw Project1.dpr hosted with ❤ by GitHub
Tags: COM, DCOM, Delphi, XML

No comments:

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04 I am planning to run qemu-system-ppc to play around QEMU ...