1

I am using xml file to create message definitions.

My xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<dds>
<types>
  <include file="home/a.shah/AR/rpc_types.xml"/>
    <module name="idl">
      <module name="test">
        <module name="Calculator">
          <struct name= "AdditionRequest" baseType="rpc::Request">
            <member name="value1" type="int32"/>
            <member name="value2" type="int32"/>
          </struct>
          <struct name= "AdditionReply" baseType="rpc::Reply">
            <member name="result" type="int32"/>
          </struct>
          <struct name= "MultiplicationRequest" baseType="rpc::Request">
            <member name="value1" type="int32"/>
            <member name="value2" type="int32"/>
          </struct>
          <struct name= "MultiplicationReply" baseType="rpc::Reply">
            <member name="result" type="int32"/>
          </struct>
        </module>
      </module>
  </module>
</types>
</dds>

My $HOME environment is set to /home/a.shah, and hence I want to replace the line

<include file="home/a.shah/AR......"/>

to

<include file="$HOME/AR/......"/>

However, when I do that I get the a lot of errors like this:

DDS_XMLFileInfoList_assertFile:!open file: $HOME/AR/rpc_types.xml
DDS_XMLInclude_initialize:!assert file info DDS_XMLInclude_new:!init XML include object RTIXMLParser_onStartTag:Parse error at line 4: Error processing tag 'include' RTIXMLParser_parseFromFile_ex:Parse error in file 'tests/data/CalculatorService.xml' DDS_XMLParser_parse_from_file:Error parsing file
DDS_QosProvider_load_profiles_from_urlI:ERROR: loading profiles file 'tests/data/CalculatorService.xml' 
DDS_QosProvider_load_profiles_from_url_groupI:ERROR: loading profiles 
DDS_QosProvider_load_profiles_from_url_listI:ERROR: loading profiles DDS_QosProvider_load_profiles_from_env_varI: ERROR: loading profiles DDS_QosProvider_load_profilesI:ERROR: loading profiles DDS_DomainParticipantFactory_load_profilesI:!load profiles DDS_DomainParticipantFactory_get_default_participant_qos:ERROR: loading profiles

Please tell me how can I change /home/a.shah/AR to $HOME/AR without these errors.

Reinier Torenbeek
  • 16,669
  • 7
  • 46
  • 69
Anokhi Shah
  • 168
  • 1
  • 8
  • See [19.6.1 Using Environment Variables in XML](https://community.rti.com/static/documentation/connext-dds/6.0.1/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/index.htm#UsersManual/Using_Environment_Variables_in_XML.htm#19.6.1_Using_Environment_Variables_in_XML%3FTocPath%3DPart%25203%253A%2520Advanced%2520Concepts%7C19.%2520Configuring%2520QoS%2520with%2520XML%7C19.6%2520XML%2520File%2520Syntax%7C_____1) – Reinier Torenbeek Apr 06 '21 at 16:55

1 Answers1

2

The solution was to use round brackets like this

<types>
  <include file="$(HOME)/AR/ar-dds/idl/ar/dds/rpc/rpc_types.xml"/>
  ...
</types>
rip...
  • 996
  • 5
  • 20
Anokhi Shah
  • 168
  • 1
  • 8
  • 1
    for anyone else reading this, remember that xml is not a shell or scripting language, it is a data markup structure. assuming that $HOME will work from the outset is a bad assumption. yes, there is a format that allows it to work, but that is because the tool processing it was written to understand the $ env var convention -- not always the case. – rip... Apr 06 '21 at 16:00