Search code examples
jaxbjaxb2xjcmaven-jaxb2-plugin

Why JAXB (jaxb2-maven-plugin) skips this attribute?


jaxb2-maven-plugin 1.3 skips an attribute from an object. I cannot modify the XSD. In the XSD (fragment):

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="classA" type="classA" substitutionGroup="classSubA"/>

    <xs:complexType name="complexClassA" mixed="true">

    <xs:attribute name="attA">
        <xs:annotation>
            <xs:appinfo>
                <moProperty value="classA:attA"/>
                <label value="Attribute A" default="true"/>
                <externAccess value="readWrite"/>
            <description value="NO COMMENTS"/>
        </xs:appinfo>
    </xs:annotation>
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:enumeration value="off"/>
            <xs:enumeration value="on"/>
        </xs:restriction>
    </xs:simpleType>
</xs:attribute>

<xs:attribute name="id" type="xs:unsignedInt">
    <xs:annotation>
        <xs:appinfo>
            <moProperty value="myClassB:id"/>
            <label value="Id" default="true"/>
            <externAccess value="readWrite"/>
            <description value="NO COMMENTS"/>
        </xs:appinfo>
    </xs:annotation>
</xs:attribute>
</xs:schema>

The Resulting Java Object (fragment):

public class ComplexClassA {
    @XmlSchemaType(name = "unsignedInt")
    protected Long id;
}

Why it is not generating the attA member?

Might it be cause the inline enumeration?

Thank you.

Udo.


Solution

  • After going to

    org.jvnet.jaxb2.maven2 maven-jaxb2-plugin

    Everything is working fine.

    Thank you for your time.