users@jaxb.java.net

avoiding anonymous complex types to generate fewer classes?

From: Andrew Ferguson <Andrew.Ferguson_at_arm.com>
Date: Mon, 28 Jun 2004 19:25:11 +0100

hi,
 
A)
    this article:
        http://www.onjava.com/pub/a/onjava/2003/12/10/jaxb.html
 
    advocates the practicse below to generate fewer classes (ie because
none are generated for anonymous types)
        1) not using anonymous complex types
        2) not using ref's
        3) naming your complex types and elements that use them with the
same identifier
 
    Is this recommended? There is also this article
 
http://www.kohsuke.org/xmlschema/XMLSchemaDOsAndDONTs.html#avoid_complex
 
    which advocates using anonymous complex types (ie the opposite to
point 1 above)
 
B) the DOsAndDONTs article also says that restricting complexTypes isn't
recommended because validators may not truly check the restrictions hold
(sorry if i have misread this..)
 
I've recently been wanting to use restriction because the classes xjc
generates would then be amenable to routines that could process the base
classes and only do more specific processing if needed - does this sound
reasonable?
 
(i've checked that the validater catches the more general content in the
restricted instance and it does seem to work?)
 
thanks,
Andrew