Reputation: 664
I'm using StAX in order to write an XML document but I can't find how to write the empty elements XML. I would like to write <element/>
instead of <element></element>
.
Upvotes: 1
Views: 1503
Reputation: 42114
Use writeEmptyElement method in XMLStreamWriter class: http://download.oracle.com/javase/6/docs/api/javax/xml/stream/XMLStreamWriter.html#writeEmptyElement%28java.lang.String%29
Upvotes: 1