users@jaxb.java.net

Using Custom bindings to generate small classes for big schemas

From: Katz Guy <Guy_Katz_at_icomverse.com>
Date: Wed, 26 Feb 2003 19:37:51 +0200

Hi;

Reading the jaxb user guide I couldn’t understand if I can acheve the
following. I would appreciate any help.

basically , In my project i have huge huge xml schemas and would like to
generate a small class(or a number of small classes) per schema which
represent a fragment of that schema.

For example; We would like the schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
        <xs:element name="a">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="b" type="xs:string"/>
                                <xs:element name="c" type="xs:string"/>
                                <xs:element name="d" type="xs:string"/>
                                <xs:element name="e">
                                        <xs:complexType>
                                                <xs:sequence>
                                                        <xs:element name="f"
type="xs:string"/>
                                                </xs:sequence>
                                        </xs:complexType>
                                </xs:element>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>


To be generated into:
Interface <someIfc>{
        public string getB();
        public void setB(String b);
}
and
Class <someName> implements <someIfc>{
        String b;
        public string getB(){return b;}
        public void setB(String b){this.b=b;}
}

Discurding most of the schema content in the generated classes. Yet when
transforming an instance of that class into XML we would like it to
transfrom according to the full scema.

For example:
An instance of class <someName> with string value of b set to "b" will be
transformed into:
<a>
        <b>b</b>
        <c/>
        <d/>
        <e>
                <f/>
        </e>
</a>

Or something like that.

I figured this would be done by custom bindings but could not find the way
to do this in the user guide.(maybe I didn’t understand the guide very well)
Is JAXB an apprepriate technology for this? I could not get this from the
manual.
I would really appreciate any respose
Thanks.



_______________________
Guy Katz
Comverse
guy.katz_at_comverse.com
+972 3 7663686