users@jaxb.java.net

Re: Polymorphism and Code generation

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Wed, 17 Dec 2008 13:21:04 +0100

This will give you a single List<Super> in X.

<xsd:complexType name="x">
    <xsd:choice maxOccurs="unbounded" minOccurs="0">
                <xsd:element name="d" type="d"/>
                <xsd:element name="e" type="e"/>
                <xsd:element name="c" type="c"/>
    </xsd:choice>
</xsd:complexType>

-W

On Wed, Dec 17, 2008 at 1:01 PM, Ingrid_Furnzel <ingrid_furnzel_at_gmx.de>wrote:

> Hi, I have a problem with code generation (xjc) and inheritance. The
> following xml structure exists: some content *some content* some content
> a, b and c shall have the same super class My xsd looks like this: SOME
> CONTENT SOME CONTENT SOME CONTENT xjc creates five classes (A, B, C, X and
> Super). Unfortunately, X has three lists: Lista; List*b and List c; That
> is not what I want. I would prefer having only one list List super; In order
> to do this I could modify the generated code with annotations:
> @XmlELements({ @XmlElement(name="a", type=A.class), @XmlElement(name="b",
> type=B.class), @XmlElement(name="c", type=C.class) }) List super; How must I
> write the xsd or the binding file to achieve this behaviour with code
> generation? The goal ist to have only one list although I have three
> different XML tags (a, b, c). Regards Ingrid
> ------------------------------
> View this message in context: **Polymorphism and Code generation<http://www.nabble.com/Polymorphism-and-Code-generation-tp21051962p21051962.html>
> Sent from the java.net - jaxb users mailing list archive<http://www.nabble.com/java.net---jaxb-users-f13500.html>at Nabble.com.
> *