Setting the default XML DOM in Delphi XE7

Managing the default XML DOM

Scanning the whats new in RAD Studio XE7 (Delphi, C++ Builder) it covers the introduction of a new XML Dom (OmniXML) meaning there are now 3 XML DOMS to choose from when setting the default XML DOM.

  • ADOM
  • OmniXML

The XML Dom defines which engine in essence is used to work with your XML documents.

Should I read on? Well if your using SOAP or XML in your projects, then this could make a difference to your speed and performance of the applications, and it takes seconds to implement.

How to set the DOM?

To make it easy to pick which DOM to use in the project by default, you can set the default DOM for the application using the “DefaultDOMVendor” global variable. (This lives in unit Xml.xmldom)

To set the Default XML DOM via code you need to add Xml.xmldom to your uses clause and in code set DefaultDOMVendor. 

Each DOM has a constant that is stored in its retrospective unit defining the XML dom, so the SUDO code to set each DOM is as follows;


  Xml.xmldom, Xml.Win.msxmldom;

DefaultDOMVendor := SMSXML;


  Xml.xmldom, Xml.omnixmldom;

DefaultDOMVendor := sOmniXmlVendor;


  Xml.xmldom, Xml.adomxmldom;

DefaultDOMVendor := sAdom4XmlVendor;

How to set this for my project?

You can easily set this in the Project Source, e.g. View > Project Source (or select the project name in the Project Manager and press Ctrl + V).

The following is an example set this the default to OmniXML.

program Project1;

 Unit1 in 'Unit1.pas' {Form1},
 Xml.xmldom, XML.OmniXMLDom;
{$R *.res}
 DefaultDOMVendor := sOmniXmlVendor;
 Application.CreateForm(TForm1, Form1);

Which DOM should I use?

In short it depends on your project, but as a simple rule, MSXML on Windows and VCL applications and OmniXML for x-platform projects.  A break down of the DOMs follows:


Fastest of the built-in RAD Studio XML vendors. Windows only. Default.

For cross-platform support, you must choose a different XML vendor. If you do not specify a different XML vendor, your application does not have XML support on other platforms than Windows, and you see a run-time exception when you run your application in other platforms.


Much faster than ADOM, but slightly slower than MSXML. Cross-platform.


Slower than the other built-in RAD Studio XML vendors. Cross-platform.

Which DOM am I using?

There are two ways to find out which DOM is being used.

TDOMVendor.Description is one way. You can get the current TDOMVendor using the GetDOMVendor function.

Alternatively, after GetDOMVendor has been called in code you can use the CurrentDOMVendor global variable.

You can also get a list of the current available DOM’s at run time using the DOMVendors global that returns a TDOMVendorList.

Is it possible to add other DOM’s in the future?

In short, Yes! TDOMVendor implements IDOMImplementation interface that is used by DOM’s to provide functionality – in the future additional DOM’s could be added that implement this interface and thus plumb directly in.


2 thoughts on “Setting the default XML DOM in Delphi XE7”

  1. Choose MSXML when you want to have to install another runtime dependency, which might already be installed and be a different version on half your customer’s systems, and which has random errors like “Out of Storage Space” that pop up while you run it.

    In short don’t use MSXML.

Leave a Reply

Your email address will not be published. Required fields are marked *