users@jaxb.java.net

RE: Reducing number of Generated classes

From: George Datuashvili <George.Datuashvili_at_Siebel.com>
Date: Tue, 21 Oct 2003 12:08:42 -0600

But you have to ask yourself why spec generates separate classes for
element declarations, and what you are going to loose if your
implementation doesn't. I think JAXB spec calls for separate class per
element declaration to disambiguate use of substitution groups. For
example if you have

Type: A
Type: B, extends A
Type: C, extends B
Element: a1, of type A
Element: b1, of type B, substitutionGroup=a1
Element: e, complexType/sequence of a1

If you haven't used block/final/abstract attributes, some of the legal
document examples are below:

1) <e><a1/></e>
2) <e><a1 xsi:type="B"/></e>
3) <e><a1 xsi:type="C"/></e>
4) <e><b1/></e>
5) <e><b1 xsi:type="C"/></e>

If your binding framework only generates classes A, B and C, it will be
unable to differentiate between 3 and 5, or 2 and 4. However it is
possible to use block/final/abstract in a schema so that only particular
combinations are legal.

Thanks,
Gia
 
> -----Original Message-----
> From: Jochen Wiedmann [mailto:jochen.wiedmann_at_softwareag.com]
> Sent: Monday, October 20, 2003 10:17 PM
> To: users_at_jaxb.dev.java.net
>
> Ryan Shoemaker - JavaSoft East wrote:
>
> > Kohsuke Kawaguchi wrote:
> >
> >>> The schema I am using (the IFX v 1.4.0 schema) always declares
> >>> everything as a XSD type (Simple or Complex) and then declares
> >>> elements to be of that type. This results in both a generated
> >>> 'Type' and 'Element' interfaces (along with the \impl classes as
> >>> well). Is there a binding option for XJC to reduce this?
> >>
> >>
> >>
> >> No, not really. Sorry.
> >>
> >
> > There are other schemas that have similar issues - UDDI and
> UBL come
> > to mind...
>
> Out of curiosity: Would that still match the JAXB
> specification? I would like to introduce such a switch to
> JaxMe, because I do not like that many classes myself, but
> did not, for reasons of compatibility to the RI.
>
>
> Jochen



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net