Home > Mobile >  How Borland/Embarcadero Delphi TXMLDocument decides which MS XML version (3.0, 6.0 or even 4.0) to u
How Borland/Embarcadero Delphi TXMLDocument decides which MS XML version (3.0, 6.0 or even 4.0) to u

Time:11-16

I have Delphi 6 program that uses TXMLDocument and during runtime it uses MS XML 3.0 parser. But this program reports The specified module could not be found error on one computer and Process Monitor (https://docs.microsoft.com/lv-lv/sysinternals/downloads/procmon) program reports that the program is trying to access MS XML 4.0 modules and registry keys. This 4.0 installation is incomplete/corrupted and that is why the access fails with The specified module could not be found.

So, the core issue is some mechanism, decision algorithm that diverts TXMLDocument from using the standard MS XML 3.0 or MS XML 6.0 versions that are on all the current Windows 10 machine and that presses TXMLDocument to use MS XML 4.0 version. What is this decision mechanism in TXMLDocument and how to correct it?

Of course, I can find, download and install MS XML 4.0 on the client computer but this seems not the be the correct solution.

CodePudding user response:

There is no secret magic here. It is well known what mechanism is used. You can see the source code for yourself in Delphi's msxmldom.pas file.

When TXMLDocument uses the MSXML DOMVendor on Windows, it simply calls CoCreateInstance() in a loop to attempt to instantiate a hard coded list of different versions of MSXML's IXMLDOMDocument COM object, in decreasing order of version, until one version finally succeeds, or they all fail.

MSXML 6.0 did not exist yet when Delphi 6 was released, so it is not a version that is attempted. And you said MSXML 4.0 is broken on your system. So it makes sense why MSXML 3.0 ends up being used.

Have a look at the following question for how to make TXMLDocument use MSXML 6.0:

How to create a TXML Document using MSXML 6.0 in Delphi 7?

  • Related