users@jaxb.java.net

Element reference and element type maping problem

From: Jarek Gilewski <jgilewski_at_unizeto.pl>
Date: Thu, 19 Apr 2007 01:24:34 -0700 (PDT)

Hello,

I'm using JAXB 2.0. I have the xsd like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

        <xsd:simpleType name="max7Identifier">
                <xsd:restriction base="xsd:string">
                        <xsd:maxLength value="7"/>
                </xsd:restriction>
        </xsd:simpleType>

        <xsd:complexType name="Text">
                <xsd:simpleContent>
                        <xsd:extension base="xsd:string">
                                <xsd:attribute name="TextLanguageCode" type="xsd:string" default="pl"/>
                        </xsd:extension>
                </xsd:simpleContent>
        </xsd:complexType>

        <xsd:complexType name="max16text">
                <xsd:simpleContent>
                        <xsd:restriction base="Text">
                                <xsd:maxLength value="16"/>
                        </xsd:restriction>
                </xsd:simpleContent>
        </xsd:complexType>

        <xsd:element name="PartyIdentifier" type="max7Identifier"/>
        <xsd:element name="Name" type="max16text"/>

        <xsd:complexType name="Party">
                <xsd:sequence>
                        <xsd:element ref="PartyIdentifier" minOccurs="0"/>
                        <xsd:element ref="Name" minOccurs="0"/>
                </xsd:sequence>
        </xsd:complexType>
</xsd:schema>

After compilation with <simple/> mode i got the following classes:

Max16Text.java
Name.java
ObjectFactory.java
Party.java
PartyIdentifier.java
Text.java

and the Party.java looks like:

public class Party {

    @XmlElement(name = "PartyIdentifier")
    protected PartyIdentifier partyIdentifier;
    @XmlElement(name = "Name")
    protected Name name;
    ...
}

The problem is that I want it to looks like:

public class Party {

    @XmlElement(name = "PartyIdentifier")
    protected String partyIdentifier;
    @XmlElement(name = "Name")
    protected Max16text name;
    ...
}

without additional PartyIdentifier.java and Name.java classes.

I don't want xjc to generate classes for ref elements. It is only a referens
to type not a new type.
How to customize binding to achieve this?
Without simple mode it is like I want but I need simple mode.

Best Regards

Jarek


-- 
View this message in context: http://www.nabble.com/Element-reference-and-element-type-maping-problem-tf3605742.html#a10073863
Sent from the java.net - jaxb users mailing list archive at Nabble.com.