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>
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> |
@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> |
key |
<!-- Default (if not specified): false |
struct KeyedPrimitiveStruct { @key short short_member; }; |
<xsd:complexType name="KeyedPrimitiveStruct"> |
resolvename annotation5 See Using Builtin Annotations (Section 1.0.1 on page 1). |
<!-- Default (if not specified): true |
struct UnresolvedPrimitiveStruct { |
<xsd:complexType name="UnresolvedPrimitiveStruct"> |
@nested or top-level annotation6 See Using Builtin Annotations (Section 1.0.1 on page 1). |
<!-- Default (if not specified): true |
@nested struct TopLevelPrimitiveStruct { short short_member; }; or TopLevelPrimitiveStruct { short short_member; }; //@top-level false |
<xsd:complexType name="TopLevelPrimitiveStruct"> <xsd:sequence> <xsd:element name="short_member" minOccurs="1" maxOccurs="1" type="xsd:short"/> </xsd:sequence> </xsd:complexType> <!-- @nested true--> |
other directives |
<!-- |
//@copy This text will be copied in the generated files |
<!--@copy This text will be copied in the generated files --> |
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 -->7 The 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= |
@use_vector annotation |
<!-- @use_vector <true|false|1|0> --> Default (if not present): 0 |
@use_vector sequence<boolean,5> myBooleanSeq; |
<xsd:element name="myBooleanSeq" minOccurs="1" maxOccurs="1" type= "tns:SequenceType_myBooleanSeq_SequenceOfboolean"/> <!-- @use_vector true --> |
© 2017 RTI