I do not see an option within javax.xml.stream.XMLEventWriter
or javax.xml.stream.XMLOutputFactory
to set either up in a way so that empty elements are written (instead of explicit start and end element pairs).
I see that Woodstox has a property to do this, but it is not standardized.
Am I missing any obvious way to do this?
No. There is no semantic difference between <x/>
and <x></x>
and the standard APIs do not provide a way to request one or the other.