users@jaxb.java.net

My experience with 'simpleMode.xsd' extension

From: Herve Bitteur <Herve.Bitteur_at_Sun.COM>
Date: Tue, 10 Apr 2007 09:45:40 +0200

Bonjour,

I've tried the simpleMode extension that Kohsuke mentioned in one of his
blog sections.
- Positive point: it does correctly handle a lot of DTD cases such as
this fragment: (fermata, fermata?)? which would otherwise result in
messages like "Fermata is already defined".
- Unexpected negative point: it shuffles the names of collections
getters between versions of my DTD.

For example, two versions of a DTD define a given element as:

    /<!ELEMENT encoding ((encoding-date | encoder | software |
    encoding-description | supports)*)>/

But one version of the DTD file is slightly different : there is an
additional element (not part of this 'encoding' element definition), and
the 'supports' element is given two additional attributes. My
understanding is that the collection of element names (and of attribute
names) is modified, and this perhaps has an impact on the algorithm used
to come up with a proper method name (just a guess).

The (normal) mode, i.e. not using simpleMode, would consistently
generate the same name of Java getter method for the two versions:

    /public List<Object> getEncodingDateOrEncoderOrSoftware()/


While the simpleMode generates either:

    /public List<Object> getEncodingDatesAndSoftwaresAndSupports()/

or:

    /public List<Object> getEncodersAndSoftwaresAndEncodingDates()/


Remember, between the 2 DTD versions, the collection has not changed,
the allowed objects in the collection are the same.
The fact that the name of the collection getter method is modified has
an obvious impact on any application program which uses the collection.

So, for the time being, I had to remove the simpleMode, in order to
avoid any impact on the user programs.

Do you have any hint about this?
Bye
/Hervé
-- 
<http://www.sun.com> 	*Hervé Bitteur*
Software Program Manager
*Sun Microsystems, Inc.*
13, Avenue Morane Saulnier
78142 Vélizy Cedex FRANCE
Phone +33 1 34 03 01 12
Mobile +33 6 86 49 04 14
Fax     +33 1 34 03 07 56
Email   herve.bitteur_at_sun.com
Skype hbitteur <skype:hbitteur?call>