Francois Perrad > CORBA-JAVA > idl2javaxml

Download:
CORBA-JAVA-2.66.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

idl2javaxml - IDL compiler to language Java mapping & XML binding

SYNOPSIS ^

idl2javaxml [options] spec.idl

OPTIONS ^

All options are forwarded to C preprocessor, except -h -i -v -x.

With the GNU C Compatible Compiler Processor, useful options are :

-D name
-D name=definition
-I directory
-I-
-nostdinc

Specific options :

-h

Display help.

-i directory

Specify a path for import (only for IDL version 3.0).

-p "m1=prefix1;..."

Specify a list of prefix (gives full qualified Java package names).

-t "m1=new.name1;..."

Specify a list of name translation (gives full qualified Java package names).

-v

Display version.

-x

Enable export (only for IDL version 3.0).

DESCRIPTION ^

idl2javaxml parses the given input file (IDL) and generates the same files as idl2java and a classHelperXML.java file that contains XML marshal/demarshal methods. The XML binding follows the CORBA to WSDL/SOAP Interworking Specification (WS-I comformant soap binding).

idl2javaxml is a Perl OO application what uses the visitor design pattern. The parser is generated by Parse::Yapp.

idl2javaxml needs a cpp executable.

CORBA Specifications, including IDL (Interface Language Definition) , the JAVA Language Mapping and CORBA to WSDL/SOAP Interworking are available on <http://www.omg.org/>.

EXAMPLE ^

 // IDL
 struct StructType {
     long    field1;
     string  field2;
 };

 // Java
 public class test
 {
   public static void main (String[] args) throws Exception
   {
     XMLOutputStreamImpl os = new XMLOutputStreamImpl (new FileOutputStream ("out.xml"));
     StructType obj = new StructType (1, "toto");
     StructTypeHelperXML.write (os, obj);
     os.close ();
   }
 }

The class StructType and StructTypeHelperXML are generated by idl2javaxml.

The class XMLOutputStreamImpl and XMLInputStreamImpl are an example of the run-time support; there derive from XMLOutputStream ans XMLInputStream that define the interface.

 // XML
 <StructType><field1>1</field1><field2>toto</field2></StructType>

This XML document is valid against the Schema generated by idl2xsd (Do you really want write by hand W3C Schema ?).

 // XSD
 <xs:schema targetNamespace="http://www.omg.org/IDL-Mapped/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.omg.org/IDL-Mapped/" elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:complexType name="StructType">
     <xs:sequence>
       <xs:element name="field1" maxOccurs="1" minOccurs="1" type="xs:int"/>
       <xs:element name="field2" maxOccurs="1" minOccurs="1" type="xs:string"/>
     </xs:sequence>
   </xs:complexType>
 </xs:schema>

The class PYXOutputStreamImpl and PYXInputStreamImpl are an example of the run-time support for Pyxie format (see <http://www.pyxie.org/>); there derive from XMLOutputStream and XMLInputStream.

 // PYX
 (StructType
 (field1
 -1
 )field1
 (field2
 -toto
 )field2
 )StructType

SEE ALSO ^

cpp, idl2html, idl2java, idl2xsd, idl2rng

COPYRIGHT ^

(c) 2004-2007 Francois PERRAD, France. All rights reserved.

This program and all CORBA::JAVA modules and all Java class (run-time support) are distributed under the terms of the Artistic Licence.

AUTHOR ^

Francois PERRAD, francois.perrad@gadz.org

syntax highlighting: