Q:

jax2b maven plugin simple type

I have a question related to the jaxb meven plugin and how it generates its classes.
I have this xsd:
<xs:element maxOccurs="1" minOccurs="0" name="CtctDtls" type="ContactDetails2"/>

 <xs:complexType name="ContactDetails2">
        <xs:sequence>
            <xs:element maxOccurs="1" minOccurs="0" name="NmPrfx" type="NamePrefix1Code"/>
            <xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
            <xs:element maxOccurs="1" minOccurs="0" name="PhneNb" type="PhoneNumber"/>
            <xs:element maxOccurs="1" minOccurs="0" name="MobNb" type="PhoneNumber"/>
            <xs:element maxOccurs="1" minOccurs="0" name="FaxNb" type="PhoneNumber"/>
            <xs:element maxOccurs="1" minOccurs="0" name="EmailAdr" type="Max2048Text"/>
            <xs:element maxOccurs="1" minOccurs="0" name="Othr" type="Max35Text"/>
        </xs:sequence>
    </xs:complexType>

 <xs:simpleType name="Max2048Text">
        <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="2048"/>
        </xs:restriction>
    </xs:simpleType>

this using org.codehaus.mojo , jaxb2-maven-plugin gets translated into:
public class ContactDetails2 {

   ...
    protected String faxNb;
    @XmlElement(
        name = "EmailAdr"
    )
    protected String emailAdr;
    ...

}

Which when marshaled it goes get converted to:
<CtctDtls>
<EmailAdr/>
</CtctDtls> 

Which is invalid because if email is present it should have at least one character.
How can I fix this? Can I change the maven plugin configuration? Or what else can I do so that if the email is an empty string this does not get generated?
https://wiki.xmldation.com/General_Information/ISO_20022/pain.008

A:

we implemented this by creating a jaxb adapter, that in the unmarshal is the string is empty we returned null.
[https://www.javacodegeeks.com/2014/12/jaxb-tutorial-xml-binding.html#adapters][1]

