Andrew Ferguson wrote:
> 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)
>
FWIW, JAXB 2.0 will hopefully reduce the need for such parctices. There is
an early draft of the 2.0 spec (subject to change) available for review[1].
I would encourage you to take a look at the new object model and send your
feedback to us.
> 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 haven't read the acrticle, but mapping derivation by restriction does not
map well to Java - there is no analog in Java's inheritence. For lack of
a better solution, the JAXB EG decided to treat derivation by restriction
exactly the same as derivation by extension.
Thanks,
--Ryan
[1]
http://java.sun.com/xml/jaxb/reference/api/index.html
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net