@noOne
Bug reports and enhancement requests can be entered at
https://jaxb.dev.java.net/issues/
You'll have to register/login.
Make sure to argue and document your case well.
In this particular case, bear in mind that a mapping between XML schema and
Java is necessarily incomplete, in both directions. I think that the XML
schema language has been designed without consideration to specific data
structuring paradigms, and this is a good thing, because it will let you
model XML closely to your data model. If, however, you need to map this
to *Java* object structures, some schema concepts just don't fit easily,
and, conversely, some common Java data types (java.util.*) don't
have immediate representations in XML.
@Ofira
Perhaps there is an acceptable solution for your case, but you'd have to
describe how the various attributes of BaseType and DerivedType relate to
each other.
-W
On 7/23/09, No 0ne <no0ne_at_no0ne.org> wrote:
>
> Seems to me like you are trying to restrict the actionName/Length in the
> derived classes (XSD restriction, right)?
>
> If so, I've been disappointed as well. Page 92 of the JAXB 2.0
> specification:
> <quote>
> * base class: A complex type definition can derive by restriction or
> extension (i.e. {derivation method} is either “extension” or
> “restriction”).
> **However, since there is no concept in Java programming
> similar to restriction, both are handled the same.**
> </quote>
>
> Which, for me, doesn't quite holds all the water one (or no0ne, for this
> instance) would expect.
> Rationale: I imagine that JAXB could be enhanced to override generated
> getters, and hook some code to implement the restriction (or at least
> allow the implementation of a plugin specific to one needs). I'm not
> saying that is safe to do in all situations, I haven't performed the
> in-depth analysis of all implications/consequences; what I'm saying:
> this is where I'd start looking into.
>
> Now, the reasons for my frustrations in relation with xjc: it even
> refuses to accept customizations related with an "XSD restricted"
> property. Wolfgang, please, once again: where should we raise
> enhancement suggestions/requests?
>
> Best regards,
>
> no0ne
> (newb as well)
>
>
> On Thu, 2009-07-23 at 11:32 +0300, ofira shaer wrote:
> > Hi.
> >
> >
> > I am trying to understand how do I define an inheritance in XSD.
> > For example, how do i define a base class
> >
> > BaseAction
> > String actionName
> > int actionLength
> > List <Fields>
> >
> >
> > and a derived class:
> >
> > DerivedAction
> > actionName = "derivedName"
> > actionLength = derivedLength
> > List<DerivedFields>
> >
> > Should I use restriction/extenstion/substitusion group?
> > I tried some options and it seems that the combination of extension
> > and restriction is pretty complicated...
> > I will be very thankful for any link or a general direction.
> >
> > Thanks.
> > Ofira.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>