users@jaxb.java.net

Re: Abstract Types and Separate Compilation Times

From: Jamie Johnson <jej2003_at_gmail.com>
Date: Tue, 10 Feb 2009 20:20:57 -0500

Thanks for the reply Wolfgang,

I tried your suggestion but I think I am missing something. I now have the
following in Data, but I can't add Implementation to this list. Am I
missing something?

    protected List<AbstractType> abstractBase;





On Tue, Feb 10, 2009 at 8:49 AM, Wolfgang Laun <wolfgang.laun_at_gmail.com>wrote:

> Hi Jamie,
>
> in Implementation.xsd you have
>
> <xs:import namespace="http://test.com/AbstractBase.xsd"
> schemaLocation="./AbstractBase.xsd"/>
> <xs:element name="Implementation"
> substitutionGroup="fb:AbstractBase">
> <xs:complexType>
> <xs:complexContent>
> <xs:extension base="fb:AbstractType">
>
> Omit the substitutionGroup attribute. You don't need this as the
> xs:extension is sufficient to give you the desired class hierarchy.
>
> You might use substitutionGroup if your schema (simply put) defines
> elements, with inline types, and you want to obtain inheritance
> structures based on these element definitions. This triggers the usage
> of the JAXBElement wrapper.
>
> Cheers
> Wolfgang
>
>
>
> On Tue, Feb 10, 2009 at 2:10 PM, Jamie Johnson <jej2003_at_gmail.com> wrote:
> > Compiling AbstractBase.xsd and Root.xsd together builds this:
> > @XmlElement(name = "AbstractBase", namespace =
> > "http://test.com/AbstractBase.xsd")
> > protected List<AbstractType> abstractBase;
> >
> > Compiling all three together builds this:
> > @XmlElementRef(name = "AbstractBase", namespace =
> > "http://test.com/AbstractBase.xsd", type = JAXBElement.class)
> > protected List<JAXBElement<? extends AbstractType>> abstractBase;
> >
> > The second result makes the result unusable as I can't do any
> substitutions.
> >
> > On Tue, Feb 10, 2009 at 1:56 AM, Wolfgang Laun <wolfgang.laun_at_gmail.com>
> > wrote:
> >>
> >> I cannot confirm that extending a complex type with abstract="true",
> >> either within the same schema or in a second schema imprting the first
> one,
> >> is sufficient to trigger the inclusion of the JAXBElement wrapper. Could
> you
> >> please post the (reduced) schema code?
> >>
> >> Wolfgang
> >>
> >> On Mon, Feb 9, 2009 at 6:47 PM, Jamie Johnson <jej2003_at_gmail.com>
> wrote:
> >>>
> >>> I am running into an issue where I have created several XSDs, xsd 1 has
> >>> an abstract type defined, xsd 2 implements the xsd (it is important to
> note
> >>> that xsd 1 has no implementations of the abstract type). If I compile
> these
> >>> schemas together I get the expected result in that the Java created has
> a
> >>> method of the form.
> >>>
> >>> setGeometry(JAXBElement<? extends GeometryBaseType>)
> >>>
> >>> but if I compile them separately the method looks like
> >>>
> >>> setGeometry(GeometryBaseType)
> >>>
> >>> which does not allow me to properly use the object generated in xsd 2.
> >>> Short of compiling everything together, how can I have this method
> generated
> >>> appropriately?
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>