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 { char char_member; }; |
<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= "PrimitiveStruct_string_member_BoundedString"> <xsd:sequence> <xsd:element name="item" minOccurs="1" maxOccurs="1"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <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="string_member" minOccurs="1" maxOccurs="1" type= "tns:PrimitiveStruct_string_member_BoundedString"/ </xsd:sequence> </xsd:complexType> |
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> |
pointer |
<!-- |
struct PrimitiveStruct { |
<xsd:complexType name="PrimitiveStruct"> |
<!-- |
struct KeyedPrimitiveStruct { |
<xsd:complexType name="KeyedPrimitiveStruct"> |
|
resolvename directive5 Directives are RTI extensions to the standard IDL grammar. For additional information about directives, see Using Custom Directives. |
<!-- |
struct UnresolvedPrimitiveStruct { |
<xsd:complexType
name="UnresolvedPrimitiveStruct"> |
top-level directive6 Directives are RTI extensions to the standard IDL grammar. For additional information about directives, see Using Custom Directives. |
<!-- |
struct TopLevelPrimitiveStruct { |
<xsd:complexType
name="TopLevelPrimitiveStruct">
<xsd:sequence>
<xsd:element name="short_member" |
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> |
constant |
IDL constants are mapped by substituting their value directly in the generated file |
||
struct |
xsd:complexType |
struct PrimitiveStruct { short short_member; }; |
<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" |
valuetype |
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= |
© 2016 RTI