I like to change the class name generated from a complex type from the following schema common.xsd. "UserType" rename to "User", "UserWithEffectiveDateType" rename to "UserWithEffectiveDate". I tried JAXB (v2.2.6) customization with "schema component designator" (SCD). However, output consists of "UserType" and "User", "UserWithEffectiveDateType" and "UserWithEffectiveDate". How to fix this problem?
common.xsd: <xsd:complexType name="UserType"> <xsd:sequence> <xsd:element name="firstname" type="xsd:string"/> <xsd:element name="lastname" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="UserWithEffectiveDateType"> <xsd:complexContent> <xsd:extension base="xsd:UserType"> <xsd:sequence> <xsd:element name="effectiveDate" type="xsd:date"> </xsd:element> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> user.xsd: <xsd:include schemaLocation="common.xsd"/> scd.xjb: <?xml version="1.0" encoding="UTF-8"?> <bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:tns="http://mycomp.com/xmlns/schemas" version="2.1"> <bindings scd="x-schema::tns"> <bindings scd="~tns:UserType"> <class name="User" /> </bindings> </bindings> <bindings scd="x-schema::tns"> <bindings scd="~tns:UserWithEffectiveDateType"> <class name="UserWithEffectiveDate" /> </bindings> </bindings> </bindings> build.xml: <xjc destdir="${jaxbout}" package="com.mycomp.webservices" source="2.0"> <arg line="-extension"/> <arg line="-b"/> <arg file="${wsdl}/scd.xjb"/> <schema dir="${schemadir}"> <include name="user.xsd"/> </schema> <depends dir="${schemadir}"> <include name="common.xsd"/> </depends> <produces dir="${jaxbout}/com/mycomp/webservices"> <include name="*.java"/> </produces> </xjc> output UserWithEffectiveDate.java: // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6 /* * <p>The following schema fragment specifies the expected content contained within this class. * <pre> * <complexType name="UserWithEffectiveDateType"> * <complexContent> * <extension base="{http://mycomp.com/xmlns/schemas}UserType"> * <sequence> * <element name="effectiveDate" type="{ http://www.w3.org/2001/XMLSchema}date"/> * </sequence> * </extension> * </complexContent> * </complexType> * </pre> */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "UserWithEffectiveDateType", propOrder = { "effectiveDate" }) public class UserWithEffectiveDate extends User { //.... }