You can describe data types with XML schemas (XSD). The format is based on the standard IDL-to-WSDL mapping described in the OMG document "CORBA to WSDL/SOAP Interworking Specification."
Example Header for XSD:
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dds="http://www.omg.org/dds" xmlns:tns="http://www.omg.org/IDL-Mapped/" targetNamespace="http://www.omg.org/IDL-Mapped/"> <xsd:import namespace="http://www.omg.org/dds" schemaLocation="rti_dds_topic_types_common.xsd"/> ... </xsd:schema>
Table 3.13 Mapping Type System Constructs to XSD describes how to map IDL types to XSD. The Connext DDS code generator, rtiddsgen, will only accept XSD files that follow this mapping.
Type/Construct |
Example |
||
IDL |
XSD |
IDL |
XSD |
char |
struct PrimitiveStruct |
<xsd:complexType name= "PrimitiveStruct"> |
|
wchar |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
|
octet |
xsd: |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
short |
xsd:short |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
unsigned short |
xsd: |
struct PrimitiveStruct { unsigned short unsigned_short_member; }; |
<xsd:complexType name="PrimitiveStruct"> |
long |
xsd:int |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
unsigned long |
xsd: |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
long long |
xsd:long |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> <xsd:sequence> |
unsigned long long |
xsd: |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
float |
xsd:float |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
double |
xsd:double |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
long |
dds: |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
boolean |
xsd:boolean |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
unbounded string |
xsd:string |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
bounded string |
xsd:string with restriction |
struct PrimitiveStruct { |
<xsd:complexType name= |
unbounded wstring |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
|
bounded wstring |
xsd:wstring with restriction |
struct PrimitiveStruct { |
<xsd:complexType name= "PrimitiveStruct_wstring_member_BoundedString" <xsd:sequence> <xsd:element name="item" minOccurs="1" maxOccurs="1"> <xsd:simpleType> <xsd:restriction base="dds:wstring"> <xsd:maxLength value="20" fixed="true"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:complexType name= "PrimitiveStruct"> <xsd:sequence> <xsd:element name="wstring_member" minOccurs="1" maxOccurs="1" type= "tns:PrimitiveStruct_wstring_member_BoundedString"/> </xsd:sequence> </xsd:complexType> |
enum |
xsd:simpleType with |
enum PrimitiveEnum { |
<xsd:simpleType name="PrimitiveEnum"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="ENUM1"/> <xsd:enumeration value="ENUM2"/> <xsd:enumeration value="ENUM3"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="PrimitiveEnum"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="ENUM1"> <xsd:annotation> <xsd:appinfo> <ordinal>10</ordinal> </xsd:appinfo> </xsd:annotation> </xsd:enumeration> <xsd:enumeration value="ENUM2"> <xsd:annotation> <xsd:appinfo> <ordinal>20</ordinal> </xsd:appinfo> </xsd:annotation> </xsd:enumeration> <xsd:enumeration value="ENUM3"> <xsd:annotation> <xsd:appinfo> <ordinal>30</ordinal> </xsd:appinfo> </xsd:annotation> </xsd:enumeration> </xsd:restriction> </xsd:simpleType> |
|
|
enum PrimitiveEnum { |
<xsd:simpleType name="PrimitiveEnum"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="ENUM1"> <xsd:annotation> <xsd:appinfo> <ordinal>10</ordinal> </xsd:appinfo> </xsd:annotation> </xsd:enumeration> <xsd:enumeration value="ENUM2"> <xsd:annotation> <xsd:appinfo> <ordinal>20</ordinal> </xsd:appinfo> </xsd:annotation> </xsd:enumeration> <xsd:enumeration value="ENUM3"> <xsd:annotation> <xsd:appinfo> <ordinal>30</ordinal> </xsd:appinfo> </xsd:annotation> </xsd:enumeration> </xsd:restriction> </xsd:simpleType> |
constant |
IDL constants are mapped by substituting their value directly in the generated file |
||
struct |
xsd:complexType |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
union |
xsd:complexType |
union PrimitiveUnion |
<xsd:complexType name="PrimitiveUnion"> <xsd:sequence> <xsd:element name="discriminator" type="xsd:int"/> <xsd:choice> <!-- case 1 -->4The discriminant values can be described using comments (as specified by the standard) or xsd:annotation tags. We recommend using annotations because comments may be removed by XSD/XML parsers. <xsd:element name="short_member" |
value-type |
xsd:complexType |
valuetype BaseValueType { |
<xsd:complexType name="BaseValueType"> <xsd:sequence> |
typedef |
Type definitions are |
typedef short ShortType; struct PrimitiveStruct { short short_member; }; typedef PrimitiveType = PrimitiveStructType; |
<xsd:simpleType name="ShortType"> <xsd:restriction base="xsd:short"/> </xsd:simpleType> <!—- Struct definition --> <xsd:complexType name="PrimitiveStruct"> |
arrays |
n xsd:complexType with There is one xsd:complexType |
struct OneArrayStruct { short short_array[2]; }; |
<!-- Array type --> <xsd:complexType name= "OneArrayStruct_short_array_ArrayOfShort"> <xsd:sequence> <xsd:element name="item" minOccurs="2" maxOccurs="2" type="xsd:short"> </xsd:element> </xsd:sequence> </xsd:complexType> <!-- Struct w unidimensional array member --> <xsd:complexType name="OneArrayStruct"> <xsd:sequence> <xsd:element name="short_array" minOccurs="1" maxOccurs="1" type= "OneArrayStruct_short_array_ArrayOfShort"/> </xsd:sequence> </xsd:complexType> |
arrays (cont’d) |
n xsd:complexType with There is one |
struct TwoArrayStruct { short short_array[2][1]; }; |
<!--Second dimension array type --> <xsd:complexType name= "TwoArrayStruct_short_array_ArrayOfShort"> <xsd:sequence> <xsd:element name="item" minOccurs="2" maxOccurs="2" type="xsd:short"> </xsd:element> </xsd:sequence> </xsd:complexType> <!-- First dimension array type --> <xsd:complexType name= "TwoArrayStruct_short_array_ArrayOfArrayOfShort"> <xsd:sequence> <xsd:element name="item" minOccurs="1" maxOccurs="1" |
bounded sequence |
xsd:complexType with |
struct SequenceStruct { |
<!-- Sequence type --> |
unbounded sequence |
xsd:complexType with sequence |
struct SequenceStruct { |
<!-- Sequence type --> <xsd:complexType name= "SequenceStruct_short_sequence_SequenceOfShort"> <xsd:sequence> <xsd:element name="item" |
array of sequences |
n + 1 xsd:complexType with There is one xsd:complexType per |
struct ArrayOfSequencesStruct { sequence<short,4> sequence_sequence[2]; }; |
<!-- Sequence declaration --> <!-- Array declaration --> |
sequence of arrays |
Sequences of arrays must be |
typedef short ShortArray[2]; struct SequenceOfArraysStruct { sequence<ShortArray,2> arrays_sequence; }; |
<!-- Array declaration --> |
sequence of sequences |
Sequences of sequences must |
typedef sequence<short,4> ShortSequence; struct SequenceOfSequences { |
<!-- Internal sequence declaration --> <xsd:complexType name="ShortSequence"> <xsd:sequence> <xsd:element name="item" minOccurs="0" maxOccurs="4" type="xsd:short"> </xsd:element> </xsd:sequence> </xsd:complexType> <!-- External sequence declaration --> |
module |
Modules are mapped adding the |
module PackageName { struct PrimitiveStruct { long long_member; }; |
<xsd:complexType name= |
include |
xsd:include |
#include "PrimitiveType.idl" |
<xsd:include schemaLocation= |
@key |
<!-- Default (if not specified): false |
struct KeyedPrimitiveStruct { @key short short_member; }; |
<xsd:complexType name="KeyedPrimitiveStruct"> |
@external or pointer |
<!-- @external Default if not specified: false |
struct PrimitiveStruct { @external long long_member; }; |
<xsd:complexType name="PrimitiveStruct"> <xsd:sequence> <xsd:element name="long_member" minOccurs="1" maxOccurs="1" type="xsd:int"/> <!-- @external true --> </xsd:sequence> </xsd:complexType> |
@optional annotation |
minOccurs attribute set to 0 or 1 Default (if not present): 1 |
struct Point { long x; long y; @optional long z; }; |
<xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1" type="xsd:int"/> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="xsd:int"/> <xsd:element name="z" minOccurs="0" maxOccurs="1" type="xsd:int"/> </xsd:sequence> </xsd:complexType> <!-- @struct true --> |
@id annotation |
<!-- @id <value> --> Default (if not present): id calculated based on the @autoid value of the enclosing type and module(s) |
@mutable struct Point { @id(56) long x; @id(57) long y; long z; }; |
<xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1" type="xsd:int"/> <!-- @id 56 --> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="xsd:int"/> <!-- @id 57 --> <xsd:element name="z" minOccurs="1" maxOccurs="1" type="xsd:int"/> </xsd:sequence> </xsd:complexType> <!-- @struct true --> <!-- @extensibility mutable--> |
@hashid annotation |
<!-- @hashid [<value>] → Default (if not present). id calculated based on the @autoid value of the enclosing type and module(s) |
@mutable struct Point { @hashid long x; @hashid(“other_y”) long y; }; |
<xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1" type="xsd:int"/> <!-- @hashid --> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="xsd:int"/> <!-- @hashid other_y--> </xsd:sequence> </xsd:complexType> <!-- @struct true --> <!-- @extensibility mutable--> |
@value annotation |
<!-- @ordinal <value>--> Default (if not present): the value of the previous enumerator plus 1 |
enum PrimitiveEnum { @value (10) ENUM1, @value (20) ENUM2, ENUM3 } |
<xsd:simpleType name="PrimitiveEnum"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="ENUM1"> <xsd:annotation> <xsd:appinfo> <ordinal>10</ordinal> </xsd:appinfo> </xsd:annotation> </xsd:enumeration> <!-- @ordinal 10--> <xsd:enumeration value="ENUM2"> <xsd:annotation> <xsd:appinfo> <ordinal>20</ordinal> </xsd:appinfo> </xsd:annotation> </xsd:enumeration> <!-- @ordinal 20--> <xsd:enumeration value="ENUM3"> </xsd:enumeration> </xsd:restriction> </xsd:simpleType> |
@default_literal annotation |
default_literal appinfo annotation with values true, false, 0, or 1 Default (if not present): 0" |
enum MyEnum { ENUM1, @default_literal ENUM2 }; |
<xsd:simpleType name="MyEnum"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="ENUM1"> </xsd:enumeration> <xsd:enumeration value="ENUM2"> <xsd:annotation> <xsd:appinfo> <default_literal>true</default_literal> </xsd:appinfo> </xsd:annotation> </xsd:enumeration> </xsd:restriction> </xsd:simpleType> |
@default annotation |
default attribute for elements inside a structure, default appinfo annotation for type definitions Default (if not present in this member or its alias types): 0, the empty string, or whichever enumerator is the default_literal |
@default(24) typedef long MyLongTypedefWithDefault; struct Point { @default(42) long x; MyLongTypedefWithDefault y; }; |
<xsd:simpleType name="MyLongTypedefWithDefault"> <xsd:restriction base="xsd:int"> <xsd:annotation> <xsd:appinfo> <default>24</default> </xsd:appinfo> </xsd:annotation> </xsd:restriction> </xsd:simpleType> <xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1" type="xsd:int" default="42"/> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="tns:MyLongTypedefWithDefault"/> </xsd:sequence> </xsd:complexType> |
@default annotation (strings) |
default attribute for alias elements inside a structure, default appinfo annotation for type definitions and regular strings inside a structure Default (if not present in this member or its alias types): 0, the empty string, or whichever enumerator is the default_literal |
@default("myDefault") typedef string MyStringTypedefWithDefault; struct DefaultString { @default("string") string x; MyStringTypedefWithDefault y; @default("myDefaultDefault") MyStringTypedefWithDefault z; }; |
<xsd:simpleType name="MyStringTypedefWithDefault"> <xsd:restriction base="xsd:string"> <xsd:annotation> <xsd:appinfo> <default>"myDefault"</default> </xsd:appinfo> </xsd:annotation> <xsd:maxLength value="255" fixed="true"/> </xsd:restriction> </xsd:simpleType> <xsd:complexType name="DefaultString_x_BoundedString"> <xsd:sequence> <xsd:element name="item" minOccurs="1" maxOccurs="1"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="255" fixed="true"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:complexType name= "DefaultString"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1" type=""tns:DefaultString_x_BoundedString""> <xsd:annotation> <xsd:appinfo> <default>"string"</default> </xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="tns:MyStringTypedefWithDefault"/> <xsd:element name="z" minOccurs="1" maxOccurs="1" type="tns:MyStringTypedefWithDefault" default="myDefaultDefault"/> </xsd:sequence> </xsd:complexType> |
@min annotation |
minInclusive attribute for elements inside a structure, min appinfo annotation for type definitions Default (if not present in this member or its alias types): the minimum possible value of the type |
@min(-32) typedef long myLongDefault; struct Point { @min(-32) long x; long y; myLongDefault myX; }; |
<xsd:simpleType name="myLongDefault"> <xsd:restriction base="xsd:int"> <xsd:annotation> <xsd:appinfo> <min>-32</min> </xsd:appinfo> </xsd:annotation> </xsd:restriction> </xsd:simpleType> <xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1"> <xsd:simpleType> <xsd:restriction base="xsd:int"> <xsd:minInclusive value="-32"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="xsd:int"/> <xsd:element name="myX" minOccurs="1" maxOccurs="1" type="tns:myLongDefault"/> </xsd:sequence> </xsd:complexType> |
@max annotation |
maxInclusive attribute for elements inside an structure, max appinfo annotation for types definitions Default (if not present in this member or its alias types): the maximum possible value of the type |
@max(31) typedef long myLongDefault; struct Point { @max(31) long x; long y; myLongDefault myX; }; |
<xsd:simpleType name="myLongDefault"> <xsd:restriction base="xsd:int"> <xsd:annotation> <xsd:appinfo> <max>31</max> </xsd:appinfo> </xsd:annotation> </xsd:restriction> </xsd:simpleType> <xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1"> <xsd:simpleType> <xsd:restriction base="xsd:int"> <xsd:maxInclusive value="31"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="xsd:int"/> <xsd:element name="myX" minOccurs="1" maxOccurs="1" type="tns:myLongDefault"/> </xsd:sequence> </xsd:complexType> |
@range annotation |
Not supported. Use min and max attributes instead |
@range(min = -32, max = 31) typedef long myLongDefault; struct Point { @range(min = -32, max = 31) long x; long y; myLongDefault myX; }; |
<xsd:simpleType name="myLongDefault"> <xsd:restriction base="xsd:int"> <xsd:annotation> <xsd:appinfo> <min>-32</min> <max>31</max> </xsd:appinfo> </xsd:annotation> </xsd:restriction> </xsd:simpleType> <xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1"> <xsd:simpleType> <xsd:restriction base="xsd:int"> <xsd:minInclusive value="-32"/> <xsd:maxInclusive value="31"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="y" minOccurs="1" maxOccurs="1" type=""xsd:int""/> <xsd:element name="myX" minOccurs="1" maxOccurs="1" type="tns:myLongDefault"/> </xsd:sequence> </xsd:complexType> |
@autoid annotation |
<!-- @autoid [<hash|sequential>] --> Default (if not present): the @autoid value in ancestor module(s) or sequential if not specified. |
@mutable @autoid(HASH) struct Point { long x; long y; }; |
<xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1" type="xsd:int"/> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="xsd:int"/> </xsd:sequence> </xsd:complexType> <!-- @struct true --> <!-- @autoid hash--> <!-- @extensibility mutable--> |
@nested or @top-level annotation |
<!-- Default (if not specified): true |
@nested struct TopLevelPrimitiveStruct { short short_member; }; or @top-level(false) struct TopLevelPrimitiveStruct { short short_member; }; |
<xsd:complexType name="TopLevelPrimitiveStruct"> <xsd:sequence> <xsd:element name="short_member" minOccurs="1" maxOccurs="1" type="xsd:short"/> </xsd:sequence> </xsd:complexType> <!-- @nested true--> |
@extensibility, @mutable, @appendable, or @final annotation |
<!-- @extensibility <final|appendable|mutable> → Default (if not present): appendable |
@mutable struct Point { long x; long y; }; |
<xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1" type="xsd:int"/> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="xsd:int"/> </xsd:sequence> </xsd:complexType> <!-- @struct true --> <!-- @extensibility mutable--> |
@allowed_data_representation |
<!-- @allowed_data_representation <xcdr|xcdr2|xml> --> Default (if not present): xcdr2 for flat data language binding; the @allowed_data_representation value in ancestor module(s) or (xcdr|xcdr2) for plain language |
@allowed_data_representation(XCDR2) @mutable struct Point { long x; long y; }; |
<xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1" type="xsd:int"/> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="xsd:int"/> </xsd:sequence> </xsd:complexType> <!-- @struct true --> <!-- @allowed_data_representation xcdr2--> <!-- @extensibility mutable--> |
@use_vector annotation |
<!-- @use_vector <true|false|1|0> --> Default (if not present): false unless code generated with -alwaysUseStdVector |
@use_vector sequence<boolean,5> myBooleanSeq; |
<xsd:element name="myBooleanSeq" minOccurs="1" maxOccurs="1" type= "tns:SequenceType_myBooleanSeq_SequenceOfboolean"/> <!-- @use_vector true --> |
@language_binding annotation |
<!-- @languageBinding <plain|flat_data> --> Default (if not present): the @language_binding value in ancestor module(s) or plain if not specified |
@language_binding (FLAT_DATA) @final struct Point { long x; long y; }; |
<xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1" type="xsd:int"/> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="xsd:int"/> </xsd:sequence> </xsd:complexType> <!-- @struct true --> <!-- @language_binding flat_data--> <!-- @extensibility final--> |
@transfer_ mode annotation |
<!-- @transferMode <inband|shmem_ref> --> Default (if not present): the @transfer_mode value in ancestor module(s) or inband if not specified |
@language_binding (SHMEM_REF) struct Point { long x; long y; }; |
<xsd:complexType name= "Point"> <xsd:sequence> <xsd:element name="x" minOccurs="1" maxOccurs="1" type="xsd:int"/> <xsd:element name="y" minOccurs="1" maxOccurs="1" type="xsd:int"/> </xsd:sequence> </xsd:complexType> <!-- @struct true --> <!-- @transfer_mode shmem_ref--> |
@resolve_name annotation |
<!-- Default (if not specified): @resolve_name of the parent type or false if not specified on parent |
struct UnresolvedPrimitiveStruct { |
<xsd:complexType name="UnresolvedPrimitiveStruct"> |
other annotations |
<!-- |
//@copy This text will be copied in the generated files |
<!--@copy This text will be copied in the generated files --> |
© 2020 RTI