rtiddsgen fails with xml input containing include statements

4 posts / 0 new
Last post
Offline
Last seen: 4 years 5 months ago
Joined: 11/14/2019
Posts: 2
rtiddsgen fails with xml input containing include statements

Hi,

I am trying to use xml-defined message types that are spread across several different xml files. Unfortunately, rtiddsgen fails with the error pasted below. Has anybody seen this? Is there an example of how to generate code from xml files that include other xml files?

Thank you,

John

/opt/rti_connext_dds-5.3.1/bin/rtiddsgen -inputXml example.xml -language C++11 -verbosity 3 -replace

INFO com.rti.ndds.nddsgen.Main Running rtiddsgen version 2.5.2, please wait ...

ERROR com.rti.ndds.nddsgen.Main Error generating the rawTree.null

ERROR com.rti.ndds.nddsgen.Main Fail:  java.lang.Exception: The file couldn't be parsed and the rawTree wasn't generated

INFO com.rti.ndds.nddsgen.Main Done (failures)

My xml files are:

<?xml version="1.0" encoding="UTF-8"?>

<types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xsi:noNamespaceSchemaLocation=       "/opt/rti_connext_dds-5.3.1/resource/app/app_support/rtiddsgen/schema/rti_dds_topic_types.xsd">

   <module name="sample">

    <struct name="IncludedStruct"> 

    <member name="example" type="long"/> 

  </struct> 

</module>

</types>

 

and 

 

<?xml version="1.0" encoding="UTF-8"?>

<types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:////opt/rti_connext_dds-5.3.1/bin/../resource/app/app_support/rtiddsgen/schema/rti_dds_topic_types.xsd">

<include file="example_include.xml"/>

</types>

 

rip
rip's picture
Offline
Last seen: 1 day 7 hours ago
Joined: 04/06/2012
Posts: 324

Does the file rti_dds_topic_types.xsd define an "include" element with an attribute "file"? because I would expect an xi:include (cf XInclude) href attribute here.

even then, the assumption would be that the xml parser that rtiddsgen uses is "XInclude" aware, and would know how to use an <xi:include href="example_include.xml"/> element.

Offline
Last seen: 4 years 5 months ago
Joined: 11/14/2019
Posts: 2

The xsd file does contain an include element with the correct attributes.

If I create a set of types in IDL (in two different files w/ an include statement), then convert to XML, then generate source code via rtiddsgen, it will properly convert and then fail to generate source code. If I attempt to convert XML containing an include statement to IDL, it will fail to parse the XML. Is this a bug in rtiddsgen? Can anybody else confirm this behavior?

Offline
Last seen: 2 years 7 months ago
Joined: 11/23/2016
Posts: 6

Hi John,

You are running into a known bug, CODEGENII-1112, Code Generator fails when the input XML or XSD file is not specified using its absolute path and the file includes another XML/XSD file (which is your case).

The issue is going to be fixed in our next maintenance release (6.0.1) scheduled to be released Early December, but meanwhile as a workaround you can specify your input file using its full path:

/opt/rti_connext_dds-5.3.1/bin/rtiddsgen -inputXml /path/to/file/example.xml -language C++11 -verbosity 3 -replace