users@jaxb.java.net

Re: Creating custom inheritance

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 29 Jul 2003 08:33:39 -0700

Tim Davidson <tim.davidson_at_greenhatconsulting.com> wrote:
> I know how to create XSDs and how to implement inheritance using XSD.
> However I need to inherit a XSD from a Java class. I mean, I want to define that
> XSD but I do not want to define the Structure it inherits from as and XSD.
> The reason I want to do this is that I do not want to marshar/unmarshal the attributes
> of that base class.

I'm not sure if I understand you correctly, but it seems like you are
asking whether XML Schema satisfy some particular use case --- namely,
to derive a new type by prohibiting certain attributes.

If so, look for some online document and see if use="prohibited" and
derivation by restriction can help you there.

Also, I'd personally recommend you to take a look at RELAX NG, which
JAXB RI also supports experimentally. It's much easier to define your
own inheritance relationship in RELAX NG than XML Schema.

Finally, we do have a customization called <xjc:superClass> and
@implClass that might have some relevance to what you are trying to do.
Search the archive for details on those features.

regards,
--
Kohsuke Kawaguchi                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com