Ao usar o domínio DataObject com CORBA, é necessário saber como o esquema XML e os tipos de ESQL correspondem aos tipos no arquivo IDL.
IDL | Esquema XML | ESQL |
---|---|---|
Booleano | xsd:boolean | BOOLEAN |
char | <xsd:simpleType name="char"> |
CHARACTER |
wchar | <xsd:simpleType name= “wchar”> |
CHARACTER |
double | xsd:double | FLOAT |
float | xsd:float | FLOAT |
octet | xsd:unsignedByte | INTEGER |
long | xsd:int | INTEGER |
Long long | xsd:long | INTEGER |
short | xsd:short | INTEGER |
cadeia | xsd:string | CHARACTER |
wstring | xsd:string | CHARACTER |
Unsigned short | xsd:unsignedShort | INTEGER |
Unsigned long | xsd:unsignedInt | INTEGER |
Unsigned long long | xsd:unsignedLong | DECIMAL |
enum myEnum {A, B, C};
interface example {
void myoperation(in myEnum input1);
};
A seguir há um esquema XML de exemplo:<xsd:simpleType name=”myEnum”>
<xsd:restriction base=”xsd:string”>
<xsd:enumeration value=”A”/>
<xsd:enumeration value=”B”/>
<xsd:enumeration value=”C”/>
</xsd:restriction>
</xsd:simpleType>
A seguir há um XML de exemplo:<example.myoperation>
<input1>A</input1>
</example.myoperation>
Typedef long myLong;
typedef sequence<long> longSeq;
interface example {
void myoperation(in longSeq input1, inout myLong input2);
};
A seguir há um esquema XML de exemplo:<xsd:complexType name="longSeq">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="xsd:int"/>
</xsd:sequence>
</xsd.complexType>
Uma sequência pode ser limitada com a
sintaxe sequence<long, 10>, que coloca um limite no arquivo XSD.<example.myoperation>
<input1>
<item>10</item>
<item>11</item>
<item>12</item>
</input1>
</example.myoperation>
struct myStruct {
char c;
string str;
octet o;
short s;
unsigned long long ull;
float f;
double d;
};
interface example {
void myoperation(in myStruct input1);
};
<xsd:complexType name="myStruct">
<xsd:sequence>
<xsd:element name="c" type="xsd:string" maxOccurs="1" minOccurs="1"/>
<xsd:element name="str" type="xsd:string" nillable="true" maxOccurs="1" minOccurs="1"/>
<xsd:element name="o" type="xsd:byte" maxOccurs="1" minOccurs="1"/>
<xsd:element name="s" type="xsd:short" maxOccurs="1" minOccurs="1"/>
<xsd:element name="ull" type="xsd:unsignedLong" maxOccurs="1" minOccurs="1"/>
<xsd:element name="f" type="xsd:float" maxOccurs="1" minOccurs="1"/>
<xsd:element name="d" type="xsd:double" maxOccurs="1" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
A seguir há um XML de exemplo:<example.myoperation>
<input1>
<c>c</c>
<str>hello</str>
<o>12</o>
<s>10</s>
<ull>110</ull>
<f>12.0</f>
<d>12.1</d>
</input1>
</example.myoperation>
ModuleName.InterfaceName.OperationName
O exemplo a seguir mostra um módulo em um arquivo IDL.Module one {
Interface OneAInterface {
};
};
O nome completo da interface chamada OneAInterface é one.OneAInterface. Em um arquivo IDL, os módulos podem ser aninhados em outros módulos. Nesse caso, o nome completo da interface pode incluir mais de um nome de módulo, iniciando a partir do módulo raiz, como:ModuleNameA.ModuleNameB.InterfaceName.OperationName
Um arquivo IDL pode conter mais de uma operação com o mesmo nome desde que as operações estejam em módulos diferentes.