class UnclosedElementCollectingEventWriter extends AbstractEventWriterWrapper {

	private final LinkedList<QName> unclosedElements = new LinkedList<>();

	public UnclosedElementCollectingEventWriter(XMLEventWriter wrappedEventWriter) {
		super(wrappedEventWriter);
	}

	@Override
	public void add(XMLEvent event) throws XMLStreamException {<FILL_FUNCTION_BODY>}

	public List<QName> getUnclosedElements() {
		return unclosedElements;
	}

}

		if (event.isStartElement()) {
			unclosedElements.addLast(event.asStartElement().getName());
		}
		else if (event.isEndElement()) {
			unclosedElements.removeLast();
		}
		super.add(event);
	
<methods>public void <init>(javax.xml.stream.XMLEventWriter) ,public void add(javax.xml.stream.events.XMLEvent) throws javax.xml.stream.XMLStreamException,public void add(javax.xml.stream.XMLEventReader) throws javax.xml.stream.XMLStreamException,public void close() throws javax.xml.stream.XMLStreamException,public void flush() throws javax.xml.stream.XMLStreamException,public javax.xml.namespace.NamespaceContext getNamespaceContext() ,public java.lang.String getPrefix(java.lang.String) throws javax.xml.stream.XMLStreamException,public void setDefaultNamespace(java.lang.String) throws javax.xml.stream.XMLStreamException,public void setNamespaceContext(javax.xml.namespace.NamespaceContext) throws javax.xml.stream.XMLStreamException,public void setPrefix(java.lang.String, java.lang.String) throws javax.xml.stream.XMLStreamException<variables>protected javax.xml.stream.XMLEventWriter wrappedEventWriter