users@jaxb.java.net

Simple mode and extra classes problem

From: Jarek Gilewski <jgilewski_at_unizeto.pl>
Date: Mon, 16 Apr 2007 22:27:04 -0700 (PDT)

Hello,

I'm using JAXB 2.1.3 and i have the following XSD:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:include schemaLocation="CommonTypes.xsd"/>
        ...
        <xsd:element name="DocumentIdentifier" type="max35Identifier"/>
        <xsd:element name="Name" type="max70text"/>
        <xsd:element name="Description" type="max210text"/>
        <xsd:complexType name="Party">
                <xsd:sequence>
                        <xsd:element name="Identifier" type="PartyIdentType" minOccurs="0"/>
                        <xsd:element ref="Name" minOccurs="0"/>
                        <xsd:element name="AdditionalName" type="max70text" minOccurs="0"/>
                        <xsd:element ref="Description" minOccurs="0"/>
                        <xsd:element ref="Address" minOccurs="0"/>
                </xsd:sequence>
        </xsd:complexType>
        ...
</xsd:schema>

max35Identifier, max70text and max210text are defined in CommonTypes.xsd

I compile this xsd using <xjc:simple/> mode and I got:

public class Party {
    @XmlElement(name = "Identifier")
    protected PartyIdentType identifier;
    @XmlElement(name = "Name")
    protected Name name;
    @XmlElement(name = "AdditionalName")
    protected Name additionalName;
    @XmlElement(name = "Description")
    protected Description description;
    @XmlElement(name = "Address")
    protected Address address;
...
}

The problem is that simple mode generate additional classes like Name and
Description but I don't want it.
I want to have:

    @XmlElement(name = "Name")
    protected Max70Text name;
    @XmlElement(name = "Description")
    protected Max210Text description;

Max70Text and Max210Text are already generated compiling CommonTypes.xsd

This generation extra classes appears whereever there is:

<xsd:element name="someName" type="someType"/>
<xsd:element ref="someName" minOccurs="0"/>

How to make xjc to use someType directly instead of generating additional
class someName which extends someType.
I would like to do it using xjb file (without touching xsd files).

Please help me. I'm stuck with this problem for few days after looking on
google and this list.

Regards Jarek.

-- 
View this message in context: http://www.nabble.com/Simple-mode-and-extra-classes-problem-tf3588897.html#a10029449
Sent from the java.net - jaxb users mailing list archive at Nabble.com.