How to load multiple XML files with RTI Connector

When you use RTI Connector, all the types, topics, domain, and entities must be defined in an XML file that gets loaded when the Connector object is created.

For example, the following snippet loads the required definitions from "config.xml" and then instantiates a new Connector object for the domain participant "MyParticipant" defined in the participant library "MyParticipantLib"

const rti = require('rticonnextdds-connector');
var connector = new rti.Connector("MyParticipantLib::MyParticipant", "config.xml");


It's not uncommon for the defintions in "config.xml" to be obtained from a different part of your development process, or from different groups in your organization. This can make it difficult to merge the various sections into a single XML file to be loaded by Connector.  For example, the type definitions may be obtained by running rtiddsgen and shared with other projects, and the QoS libraries may be managed separately through a git repository.

Unfortunately the Connector constructor expects a single string identifying the resources be to loaded by RTI Connext DDS. This HOWTO article explains how to instruct Connector to deal with such situations.


Including type definitions from XML

If only your type definitions are coming from one or more files, the easiest way to deal with the problem is to use the <include> tag from inside the main XML file. Unfortunately the <include> tag applies only to types and not to other sections of the XML.

For example, suppose you obtain your type definitions from an IDL, but you have all the QoS and domain definition in a final XML file you load into Connector. In this case you can run:

rtiddsgen -convertToXml myTypes.idl

to generate the file myTypes.xml

Then in your XML you can load myTypes.xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<dds xmlns:xsi="" xsi:noNamespaceSchemaLocation="" version="6.0.0">
   <include file="myTypes.xml"/>
<domain_library name="MyDomainLib">


Note that <include> is a valid tag only for the <types> tag and cannot be used in other sections of the XML file.


Using URL Groups

If your types, domain libraries, qos libraries and participant libraries are distributed over a set of files, you can use URL Groups to tell Connector to load multiple files.

URL Groups are explained in the RTI Connext DDS User's manual. Because Connector is built on top of RTI Connext DDS, the string used to identify the XML is interpreted by RTI Connext DDS and can be formatted to use URL groups.

URL Groups are a series of URLs identifying individual XML files that can be joined using a "|" (pipe character) or ";" (semicolon).  When URL groups are used for redundancy, the format is:

[URL1 | URL2 | URL2 | ... | URLn]

In this case RTI Connext DDS (and Connector) will start to locate and load the XML files from the left to the right and will stop as soon as the resource (the XML file) is successfully loaded.

URL groups can be used also to sequentially load multiple files using the ';' separator. In this case the format of the string is:

[URL1 ; URL2 ; URL2 ; ... ; URLn]


For example, if you want to load the XML definitions from three different files, you can use the following example:

const rti = require('rticonnextdds-connector');
var connector = new rti.Connector("MyParticipantLib::MyParticipant", "[file:///etc/rti/types.xml];[file:///etc/rti/myQos.xml];[file:///home/joe/data/def.xml]");

 In this case Connector will load and merge all the definitions from the following files:

  • /etc/rti/types.xml
  • /etc/rti/myQos.xml
  • /home/joe/data/def.xml

You can also embed entire XML sections in the URL group itself, using the "str://" format:

var connector = new rti.Connector("MyParticipantLib::MyParticipant", '[file:///etc/rti/types.xml];[file:///etc/rti/myQos.xml];[str://<dds><domain_library name="MyDomainLib"><domain name="MyDomain" domain_id=55...]');

Note that if you use URL groups with the ';' separator and one of the resource file is not available, you will get an error such as the following:

DDS_QosProvider_load_profiles_from_url_groupI:ERROR: opening profiles group files '/etc/rti/types.xml'


Another approach to this problem is to leverage the capability of RTI Connext DDS to load XML as defined through the environment variable NDDS_QOS_PROFILES. You can then create a generic DDS application where you don't specify any XML file in the code, but you rely on the value defined in NDDS_QOS_PROFILES. For example using the RTI Connector API, you can write a javascript app that just build the domain participant without specifying where is declared:

const rti = require('rticonnextdds-connector');
var connector = new rti.Connector("MyParticipantLib::MyParticipant");
 Then define the URL groups in the NDDS_QOS_PROFILES environment variable before launching the application:
NDDS_QOS_PROFILES='[file:///etc/rti/types.xml];[file:///etc/rti/myQos.xml]' node ./myApp.js

Please refer to chapter 18.5: How to Load XML-Specified QoS Settings for additional information and examples.