You can describe user data types with Extensible Markup Language (XML) notation. Connext DDS provides DTD and XSD files that describe the XML format; see <NDDSHOME>/resource/app/app_support/rtiddsgen/schema/rti_dds_topic_types.dtd and <NDDSHOME>/resource/app/app_support/rtiddsgen/schema/rti_dds_topic_types.xsd, respectively (in 5.x.y, the x and y stand for the version numbers of the current release). (<NDDSHOME> is described in Paths Mentioned in Documentation.)
The XML validation performed by RTI Code Generator always uses the DTD definition. If the <!DOCTYPE> tag is not in the XML file, RTI Code Generator will look for the default DTD document in <NDDSHOME>/resource/schema. Otherwise, it will use the location specified in <!DOCTYPE>.
We recommend including a reference to the XSD/DTD files in the XML documents. This provides helpful features in code editors such as Visual Studio® and Eclipse™, including validation and auto-completion while you are editing the XML. We recommend including the reference to the XSD document in the XML files because it provides stricter validation and better auto-completion than the DTD document.
To include a reference to the XSD document in your XML file, use the attribute
xsi:noNamespaceSchemaLocation in the <types> tag. For example :
<?xml version="1.0" encoding="UTF-8"?> <types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "<NDDSHOME>/resource/app/app_support/rtiddsgen/schema/rti_dds_topic_types.xsd"> ... </types>
To include a reference to the DTD document in your XML file, use the <!DOCTYPE> tag. For example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE types SYSTEM "<NDDSHOME>/resource/app/app_support/rtiddsgen/schema/rti_dds_topic_types.dtd"> <types> ... </types>
Mapping Type System Constructs to XML shows how to map the type system constructs into XML.
Type/Construct |
Example |
||
IDL |
XML |
IDL |
XML |
char |
char8 |
char char_member; |
<member name="char_member" |
wchar |
char32 |
wchar wchar_member; |
<member name="wchar_member" |
octet |
byte |
octet octet_member; |
<member name="octet_member" |
short |
int16 |
short short_member; |
<member name="short_member" |
unsigned short |
uint16 |
unsigned short |
<member name="unsigned_short_member" |
long |
int32 |
long long_member; |
<member name="long_member"type="int32"/> |
unsigned long |
uint32 |
unsigned long |
<member name= "unsigned_long_member" |
long long |
int64 |
long long |
<member name="long_long_member" |
unsigned long long |
uint64 |
unsigned long long |
<member name="unsigned_long_long_member" |
float |
float32 |
float float_member; |
<member name="float_member" |
double |
float64 |
double double_member; |
<member name="double_member" |
long double |
float128 |
long double |
<member name= "long_double_member" |
boolean |
boolean |
struct PrimitiveStruct { |
<struct name="PrimitiveStruct"> |
unbounded string |
string without stringMaxLength attribute or with stringMaxLength set to -1 |
struct PrimitiveStruct { |
<struct name="PrimitiveStruct"> |
bounded string |
string with stringMaxLength attribute |
struct PrimitiveStruct { |
<struct name="PrimitiveStruct"> |
unbounded wstring |
wstring without stringMaxLength attribute or with stringMaxLength set to -1 |
struct PrimitiveStruct { |
<struct name="PrimitiveStruct"> or <struct name="PrimitiveStruct"> |
bounded wstring |
wstring with stringMaxLength attribute |
struct PrimitiveStruct { |
<struct name="PrimitiveStruct"> |
@external or pointer |
external attribute with values true, false, 0, or 1. Default (if not present): 0 |
struct PrimitiveStruct { @external long long_member; }; |
<struct name="PointerStruct"> <member name="long_member" type="long" external="true"/> </struct> |
key annotation 1See Using Builtin Annotations (Section 1.0.1 on page 1). |
key attribute with values |
struct KeyedPrimitiveStruct { @key short short_member; }; |
<struct name="KeyedPrimitiveStruct"> |
resolve-name annotation2See Using Builtin Annotations (Section 1.0.1 on page 1). |
resolveName attribute with values true, false, 0, or 1 |
struct |
<struct name= |
@nested or top-level annotation 3See Using Builtin Annotations (Section 1.0.1 on page 1). |
nested attribute with values true, false, 0 ,or 1 |
@nested struct or TopLevelPrimitiveStruct { |
@nested struct TopLevelPrimitiveStruct { short short_member; }; or TopLevelPrimitiveStruct { short short_member; }; //@top-level (false) or <struct name= "TopLevelPrimitiveStruct" nested="true"> <member name= "short_member" type="short"/> </struct> |
Other directives 4See Using Builtin Annotations (Section 1.0.1 on page 1). |
directive tag |
//@copy (This text will be |
<directive kind="copy"> |
enum |
enum tag |
enum PrimitiveEnum { |
<enum name="PrimitiveEnum"> |
enum PrimitiveEnum { ENUM1=10, ENUM2=20, ENUM3 } enum PrimitiveEnum { @value (10) ENUM1, @value (20) ENUM2, @value (30) ENUM3 } |
<enum name="PrimitiveEnum"> |
||
constant |
const tag |
const double PI = 3.1415; |
<const name="PI" type="double" |
struct |
struct tag |
struct PrimitiveStruct { |
<struct name="PrimitiveStruct"> |
union |
union tag |
union PrimitiveUnion switch |
<union name="PrimitiveUnion"> |
valuetype |
valuetype tag |
valuetype BaseValueType { |
<valuetype name="BaseValueType"> |
typedef |
typedef tag |
typedef short ShortType; |
<typedef name="ShortType" type="short"/> |
struct PrimitiveStruct { typedef PrimitiveStruct |
<struct name="PrimitiveStruct"> |
||
arrays |
Attribute |
struct OneArrayStruct { |
<struct name="OneArrayStruct"> |
struct TwoArrayStruct { |
<struct name="TwoArrayStruct"> |
||
bounded sequence |
Attribute sequenceMaxLength > 0 |
struct SequenceStruct { |
<struct name="SequenceStruct"> |
unbounded sequence |
Attribute sequenceMaxLength set to -1 |
struct SequenceStruct { |
<struct name="SequenceStruct"> |
array of sequences |
Attributes sequenceMaxLength and arrayDimensions |
struct |
<struct name= "ArrayOfSequenceStruct"> |
sequence of arrays |
Must be implemented with a typedef tag |
typedef short struct |
<typedef name="ShortArray" |
sequence of sequences |
Must be implemented with a typedef tag |
typedef sequence<short,4> struct |
<typedef name="ShortSequence" type="short"sequenceMaxLength="4"/> <struct name="SequenceofSequencesStruct"> |
module |
module tag |
module PackageName { |
<module name="PackageName"> |
include |
include tag |
#include |
<include file="PrimitiveTypes.xml"/> |
@use_vector annotation |
useVector attribute with values true, false, 0 or 1 Default (if not present): 0 |
@use_vector |
<member name= |
© 2017 RTI