Remove empty XML tags in jaxb marshalling
<p>How can I avoid empty tags with jaxb marshaller?</p>

<pre><code>final Marshaller marshaller = JAXBContext.newInstance(content.getClass()).createMarshaller();

final ByteArrayOutputStream stream = new ByteArrayOutputStream();
final XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(stream);

final CapitalizedXMLStreamWriter xmlStreamWriter = new CapitalizedXMLStreamWriter(streamWriter);

marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocation);
marshaller.setAdapter(new NullAdapter());
marshaller.marshal(content, xmlStreamWriter);

xmlStreamWriter.flush();
xmlStreamWriter.close();

final String xml = new String(stream.toByteArray());
</code></pre>

<p><code>CapitalizedXMLStreamWriter</code> is my writer that extends <code>StreamWriterDelegate</code>. It just overrides <code>writeStartElement</code> as <code>this.mDelegate.writeStartElement(arg0, capitalize(arg1));</code></p>

<p>And I use annotations in package-info for namespaces.</p>

<p>I tried to use <code>marshaller.setAdapter()</code>  but nothing happends.</p>