rticonnextdds-getting-started icon indicating copy to clipboard operation
rticonnextdds-getting-started copied to clipboard

Converting hello_world.idl to XML for Python

Open mattmz opened this issue 4 years ago • 2 comments

I am running the 2_hello_world example for Python. I am hitting a parsing issue with the converted hello_world.idl XML and while I can work around it by following other examples, I am wondering if I am performing any steps incorrectly or if there are additional steps apart from rticonnextdds-getting-started/2_hello_world/python/README.md.

To convert hello_world.idl to XML I am using:

rtiddsgen -convertToXml ../hello_world.idl

The output XML is:

<?xml version="1.0" encoding="UTF-8"?>
<types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:////Applications/rti_connext_dds-6.0.1/bin/../resource/app/app_support/rtiddsgen/schema/rti_dds_topic_types.xsd">
<struct name= "HelloWorld">
  <member name="msg" stringMaxLength="256" type="string"/>
</struct>
</types>

Next I run HelloWorldPublisher.py with the following error output:

python3 HelloWorldPublisher.py

DDS_XMLStruct_initialize:!init XML struct object DDS_XMLStruct_newI:!init XML struct object RTIXMLParser_onStartTag:Parse error at line 3: Error processing tag 'struct' RTIXMLParser_parseFromFile_ex:Parse error in file '/Users/test/Documents/test/rticonnextdds-getting-started/2_hello_world/python/../hello_world.xml' DDS_XMLParser_parse_from_file:Error parsing file DDS_QosProvider_load_profiles_from_urlI:ERROR: loading profiles file '/Users/test/Documents/test/rticonnextdds-getting-started/2_hello_world/python/../hello_world.xml' DDS_QosProvider_load_profiles_from_url_groupI:ERROR: loading profiles DDS_QosProvider_load_profiles_from_url_sequenceI:ERROR: loading profiles DDS_QosProvider_load_profiles_from_policyI:ERROR: loading profiles DDS_QosProvider_load_profilesI:ERROR: loading profiles Traceback (most recent call last): File "HelloWorldPublisher.py", line 83, in run_example(args.domain_id, args.sample_count) File "HelloWorldPublisher.py", line 30, in run_example provider = dds.QosProvider(FILE) rti.connextdds.Error: DDS_XMLStruct_initialize:!init XML struct object DDS_XMLStruct_newI:!init XML struct object RTIXMLParser_onStartTag:Parse error at line 3: Error processing tag 'struct' RTIXMLParser_parseFromFile_ex:Parse error in file '/Users/test/Documents/test/rticonnextdds-getting-started/2_hello_world/python/../hello_world.xml' DDS_XMLParser_parse_from_file:Error parsing file DDS_QosProvider_load_profiles_from_urlI:ERROR: loading profiles file '/Users/test/Documents/test/rticonnextdds-getting-started/2_hello_world/python/../hello_world.xml' DDS_QosProvider_load_profiles_from_url_groupI:ERROR: loading profiles DDS_QosProvider_load_profiles_from_url_sequenceI:ERROR: loading profiles DDS_QosProvider_load_profiles_from_policyI:ERROR: loading profiles DDS_QosProvider_load_profilesI:ERROR: loading profiles reload profiles

I can fix this by adopting an XML style similar to the other examples. Example:

<?xml version="1.0" encoding="UTF-8"?>
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.1/rti_dds_qos_profiles.xsd"
   version="6.0.1">
  <type_library name="builtin_topics_lib">
    <struct name= "HelloWorld">
      <member name="msg" stringMaxLength="256" type="string"/>
    </struct>
  </type_library>
</dds>

I am wondering if there is additional configuration I need for rtiddsgen to have the XML conversion work seamlessly or if this is a known issue/change.

Thank you!

mattmz avatar Mar 08 '21 02:03 mattmz

Hello Matthew!

You aren't doing anything wrong - this is a known issue. You do need to use that workaround for now, but there is a fix in our upcoming Connext DDS release.

Thank you, Rose

rosemwahlin avatar Mar 08 '21 18:03 rosemwahlin

Thank you for the information! Much appreciated.

mattmz avatar Mar 08 '21 18:03 mattmz