Q:

Suppress empty string elements in JAXB ArrayList

There solutions to ignore the empty string elements, but in my case I have a Array list which has many empty strings ( Not null ). 
So I get lots of empty elements in the generated output. 
Thoughts ?
@XmlElement
private List<String> fileNumber;

This is the output:
<fileNumber>25478</fileNumber>
<fileNumber>45875</fileNumber>
<fileNumber></fileNumber>
<fileNumber></fileNumber>

I can solve this issue by removing them in the list at the setFileNumber. (Like below)
public void setFileNumber(List<String> fileNumber) {
    fileNumber.removeAll(Collections.singleton(""));
    this.fileNumber = fileNumber;
}

But is there a solution at JAXB level ? Like nillable ?

A:

You could use a marshal event call back method for this use case (see:  http://docs.oracle.com/javase/7/docs/api/javax/xml/bind/Marshaller.html#marshalEventCallback).  This method would go on the class with the fileNumber property, and your JAXB implementation will call this method before it marshals the object giving you the opportunity to do any necessary clean up.
private void beforeMarshal(Marshaller marshaller) {
    fileNumber.removeAll(Collections.singleton(""));
}

