users@jaxb.java.net

Re: Specifying Interfaces that generated classes extend/implement

From: Marcus Walls <marcus.walls_at_ASPECTIVE.COM>
Date: Wed, 09 Jul 2003 09:55:48 -0600

On Wed, 9 Jul 2003 09:45:50 -0400, Sekhar Vajjhala wrote:

>You are asking for a way to allow a user to discover and
>specify inheritance relationships (those which are not
>speicifed using the XML schema features ).

I guess that may be one way of saying it.

>JAXB EA contained a customization for this purpose but
>JAXB EA was based on DTD. We considered support for such
>a customization but but dropped it on the assumption that
>the since XML schema (unlike DTD), provides a way to define
>inheritance type hierarchies, the assumption was that the
>schema would be designed with the desired inheritance
>hierarchy.
>
>JAXB, then provides a way to map the inheritance hierarchy
>specified in the schema to a Java inheritance hierarchy;
>support for this feature was therefore dropped.

I'm no schema expert - I'm only using it "under sufference"
because JAXB uses it to achieve what I need.

It may have been [may even be] possible to design the schema
in such a way, but I'm wouldn't know how. Additionally, is
it not fair to say that my request is more to do with the
java representation of the marshalled XML, rather than the
schema itself and therefore it would be cleaner to implement
this as part of the transformation from schema to java?

Additionally I'm not sure if the assumption is correct.
What can one do if the schema can't be modified and it doesn't
represent the desired inheritance hierarchy?

It would be more flexible to permit the feature that was
dropped, but then I guess it's easy for me to say that whilst
not knowing the cost associated with keeping it!

Maybe it might help if I give you some more context:

My application trades XML "messages" with another application,
and the XML conversations have been strictly defined. I am
writing schemas so that I can use JAXB to produce and consume
these messages. Because of my application, and potential
requirement changes, I need to have a separate schema for
each message.

Therefore, in my current position I cannot change the XML but
I do have complete control over the schemas.

I am trying to factor out common features from my XML messages
and make the generated object that corresponds to the common
features, implement an interface.

Would it be possible to put this feature back in in a future
release?

Marcus