users@jaxb.java.net

typesafe enum class not being generated

From: Farrukh S. Najmi <farrukh_at_wellfleetsoftware.com>
Date: Fri, 22 Sep 2006 10:50:11 -0400

This must be a really simple oversight on my part. Thanks in advance for
your help.

I am migrating an app from JAXB 1.0 to JAXB 2.0.

*Problem*

In my generated bindings I do not get the typesafeEnum class I have
specified in an external binding customization (bad). Note that the rest
of the binding classes are generated just as expected (good).

Is there some way to debug this further to understand why? Not that the
customization rule's XPATH expression worked for JAXB 1.0 using xjc. Is
there anything odd about wsimport compared to xjc?

*Schema*
I have the following schema in a file called query.xsd:

  <complexType name="ResponseOptionType">
    <attribute default="RegistryObject" name="returnType">
      <simpleType>
        <restriction base="NCName">
          <enumeration value="ObjectRef"/>
          <enumeration value="RegistryObject"/>
          <enumeration value="LeafClass"/>
          <enumeration value="LeafClassWithRepositoryItem"/>
        </restriction>
      </simpleType>
    </attribute>
    <attribute default="false" name="returnComposedObjects" type="boolean"/>
  </complexType>

*External Binding Customization*

    <jxb:bindings schemaLocation="../../ebxmlrr-spec/src/xsd/query.xsd">
        <jxb:bindings node="/xsd:schema">
            <jxb:schemaBindings>
                <jxb:package name="org.freebxml.omar.jaxb.bindings.query"/>
            </jxb:schemaBindings>
        </jxb:bindings>

        <jxb:bindings
node="//xsd:complexType[@name='ResponseOptionType']//xsd:attribute[@name='returnType']/xsd:simpleType">
            <jxb:typesafeEnumClass name="ReturnType"/>
        </jxb:bindings>

        <jxb:bindings
node="//xsd:complexType[@name='CompoundFilterType']//xsd:attribute[@name='logicalOperator']/xsd:simpleType">
            <jxb:typesafeEnumClass name="LogicalOperator"/>
        </jxb:bindings>

        <jxb:bindings
node="//xsd:complexType[@name='SimpleFilterType']//xsd:attribute[@name='comparator']/xsd:simpleType">
            <jxb:typesafeEnumClass name="Comparator"/>
        </jxb:bindings>

    </jxb:bindings>

*Ant Target*

The following ant target is used to generate JAXB 2 bindings using
wsimport JAX-WS tool:

    <target name="wsimportRegistryServices">
        <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
            <classpath path="${javac.classpath}"/>
        </taskdef>
        <wsimport
wsdl="${basedir}/../ebxmlrr-spec/src/wsdl/ebXMLRegistryServices.wsdl"
            destDir="build/classes"
            sourcedestdir="src"
            keep="true"
            verbose="true">
            <binding dir="conf"
includes="jaxb-xsd-ebXMLRegistryServices.xml,
jaxb-wsdl-ebXMLRegistryServices.xml"/>
        </wsimport>
    </target>


-- 
Regards,
Farrukh
Web: http://www.wellfleetsoftware.com