Search code examples
xsdjaxb2

How to access jaxb:class element


How do I get the jaxb:class element to show? I currently have the following xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    jaxb:version="2.0" jaxb:extensionBindingPrefixes="xjc"
    elementFormDefault="qualified" targetNamespace="***"
    xmlns:common="***">

    <xs:complexType name="IdentifiableDTO" abstract="true">
        <xs:annotation>
            <xs:appinfo></xs:appinfo>
        </xs:annotation>
        <xs:attribute name="id" type="common:uuid" />
    </xs:complexType>
</xs:schema>

But the only elements I can access within the xs:appinfo is jaxb:globalBindings and jaxb:javaType. I need to specify the jaxb:class so I can add some custom behaviour.


Solution

  • What is exactly the problem with:

    <xs:complexType name="IdentifiableDTO">
        <xs:annotation>
            <xs:appinfo>
                <jaxb:class name="MySpecificIdentifiableDTOClassName"/>
            </xs:appinfo>
        </xs:annotation>
        <!-- ... -->
    </xs:complexType>
    

    What do you mean by "get the jaxb:class element to show?"