XML equivalent to ifdef

4 posts / 0 new
Last post
Offline
Last seen: 1 year 3 months ago
Joined: 09/14/2023
Posts: 2
XML equivalent to ifdef

Hi all,

I currently have a large set of xml files that I am trying to convert into idl and c++. When I execute the command 'rtiddsgen -inputXML xmlfile.xml' I get duplicate sysmbol errors. Is there an ifdef equivalent in the XML format such that files are only included once when making the reference tree? 

Organization:
Howard's picture
Offline
Last seen: 20 hours 21 min ago
Joined: 11/29/2012
Posts: 618

Sorry, the XML specification doesn't have anything that resembles #ifdef.  However, I'm not sure what you mean by duplicate symbol errors.  rtiddsgen generally works on a single XML file at a time.  XML files don't include other XML files (not supported in the general specification).  What we do have is some syntax that allows our parsers in services such as RTI Routing Service to load type definition files as specified in an XML file, but that's not syntax that rtiddsgen recognizes.

Offline
Last seen: 1 year 3 months ago
Joined: 09/14/2023
Posts: 2

Thanks Howard. That is quite unfortunate news. I suppose I will have to write the rawTree myself. 

In the xml generation there are <include file="filename.xml"/> tags that are read by rtiddsgen. If I have 3 xml files, A,B,C. A is dependant on B and C. If B is also dependant on C, then building A with rtiddsgen will result in an error because C is being read multiple times.

I should have noted I am using rtiddsgen 2.5.2 

actual error:

myFILE.xml lime X duplicate symbol 'my symbol' was previously defined in file myFILE.xml line X; rawTree was not generated

Howard's picture
Offline
Last seen: 20 hours 21 min ago
Joined: 11/29/2012
Posts: 618

Ah, yes, sorry, I forgot that the <include> feature is supported and used for defining <types> in XML files that would be parsed by RTIDDSGEN.

 

So, good news and bad news.  The bad news is that there is no workaround, except to refactor the XML file <include> topology not to have multiple inclusion of the same file.

The good news is that with our next version of RTI Connext 7.2.0, rtiddsgen has been modified so that an XML file will never be included more than once...and this will be done without requiring any annotation like #ifdef.

So, your current set of XML files are likely to be parsable by rtiddsgen in Connext 7.2.0.