// Path: src/main/java/de/graphml/writer/model/DefaultKeys.java
// public enum DefaultKeys implements Key{
// 	DESCRIPTION_FOR_GRAPH("d0", "graph", "attr.name", "Beschreibung", "attr.type", "string"),
// 	URL_FOR_NODE("d4", "node", "attr.name", "url", "attr.type", "string"),
// 	DESCRIPTION_FOR_NODE("d5", "node", "attr.name", "description", "attr.type", "string"),
// 	URL_FOR_EDGE("d8", "edge", "attr.name", "url", "attr.type", "string"),
// 	DESCRIPTION_FOR_EDGE("d9", "edge", "attr.name", "description", "attr.type", "string");
// 	
// 	public final String id;
// 	public final String forName;
// 	public final String attrName;
// 	public final String attrValue;
// 	public final String attrTypeName;
// 	public final String attrTypeValue;
// 	
// 	DefaultKeys(String id, String forName, String attrName, String attrValue, String attrTypeName, String attrTypeValue){
// 		this.id = id;
// 		this.forName = forName;
// 		this.attrName= attrName;
// 		this.attrValue = attrValue;
// 		this.attrTypeName = attrTypeName;
// 		this.attrTypeValue = attrTypeValue;
// 	}
// 	@Override
// 	public String getId() {
// 		return id;
// 	}
// 	@Override
// 	public void writeTo(ElementWriter w) {
// 		w.startElement("key");
// 		w.writeAttribute("id", id);
// 		w.writeAttribute("for", forName);
// 		
// 		w.writeAttribute(attrTypeName, attrTypeValue);
// 		if (attrName != null){
// 			w.writeAttribute(attrName, attrValue);
// 		}
// 		w.endElement();
// 	}
// }
// 
// Path: src/main/java/de/graphml/writer/model/Edge.java
// public interface Edge{
// 	void writeStart(ElementWriter writer, String id, String source, String target);
// 	void writeEnd(ElementWriter writer);
// }
// 
// Path: src/main/java/de/graphml/writer/model/ElementWriter.java
// public interface ElementWriter {
// 
// 	void startData(Key key);
// 
// 	void startElement(String localName);
// 
// 	void startElement(String namespaceURI, String localName);
// 
// 	void writeAttribute(String localName, String value);
// 
// 	void writeAttribute(String localName, Boolean value);
// 
// 	void writeAttribute(String localName, Double value);
// 
// 	void writeAttribute(String localName, Integer value);
// 
// 	void writeText(String description);
// 
// 	void endElement();
// }
// 
// Path: src/main/java/de/graphml/writer/model/Graph.java
// public interface Graph{
// 	void writeStart(ElementWriter writer, String id);
// 	void writeEnd(ElementWriter writer);
// }
// 
// Path: src/main/java/de/graphml/writer/model/Key.java
// public interface Key {
// 	String getId();
// 	void writeTo(ElementWriter writer);
// }
// 
// Path: src/main/java/de/graphml/writer/model/Node.java
// public interface Node{
// 	void writeStart(ElementWriter writer, String id);
// 	void writeEnd(ElementWriter writer);
// }


import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import de.graphml.writer.model.DefaultKeys;
import de.graphml.writer.model.Edge;
import de.graphml.writer.model.ElementWriter;
import de.graphml.writer.model.Graph;
import de.graphml.writer.model.Key;
import de.graphml.writer.model.Node;
		while (openElements > 0) {
			elementWriter.endElement();
		}
		try {
			xtw.writeEndDocument();
			xtw.flush();
			xtw.close();
		} catch (XMLStreamException e) {
			throw new RuntimeException(e);
		}
	}

	private class InternalWriter implements ElementWriter {

		@Override
		public void endElement() {
			if (openElements == 0) {
				throw new IllegalStateException("no open element found");
			}
			try {
				openElements--;
				xtw.writeEndElement();
			} catch (XMLStreamException e) {
				throw new RuntimeException(e);
			}
		}

		@Override
		public void writeText(String description) {
			try {
// Path: src/main/java/de/graphml/writer/model/DefaultKeys.java
// public enum DefaultKeys implements Key{
// 	DESCRIPTION_FOR_GRAPH("d0", "graph", "attr.name", "Beschreibung", "attr.type", "string"),
// 	URL_FOR_NODE("d4", "node", "attr.name", "url", "attr.type", "string"),
// 	DESCRIPTION_FOR_NODE("d5", "node", "attr.name", "description", "attr.type", "string"),
// 	URL_FOR_EDGE("d8", "edge", "attr.name", "url", "attr.type", "string"),
// 	DESCRIPTION_FOR_EDGE("d9", "edge", "attr.name", "description", "attr.type", "string");
// 	
// 	public final String id;
// 	public final String forName;
// 	public final String attrName;
// 	public final String attrValue;
// 	public final String attrTypeName;
// 	public final String attrTypeValue;
// 	
// 	DefaultKeys(String id, String forName, String attrName, String attrValue, String attrTypeName, String attrTypeValue){
// 		this.id = id;
// 		this.forName = forName;
// 		this.attrName= attrName;
// 		this.attrValue = attrValue;
// 		this.attrTypeName = attrTypeName;
// 		this.attrTypeValue = attrTypeValue;
// 	}
// 	@Override
// 	public String getId() {
// 		return id;
// 	}
// 	@Override
// 	public void writeTo(ElementWriter w) {
// 		w.startElement("key");
// 		w.writeAttribute("id", id);
// 		w.writeAttribute("for", forName);
// 		
// 		w.writeAttribute(attrTypeName, attrTypeValue);
// 		if (attrName != null){
// 			w.writeAttribute(attrName, attrValue);
// 		}
// 		w.endElement();
// 	}
// }
// 
// Path: src/main/java/de/graphml/writer/model/Edge.java
// public interface Edge{
// 	void writeStart(ElementWriter writer, String id, String source, String target);
// 	void writeEnd(ElementWriter writer);
// }
// 
// Path: src/main/java/de/graphml/writer/model/ElementWriter.java
// public interface ElementWriter {
// 
// 	void startData(Key key);
// 
// 	void startElement(String localName);
// 
// 	void startElement(String namespaceURI, String localName);
// 
// 	void writeAttribute(String localName, String value);
// 
// 	void writeAttribute(String localName, Boolean value);
// 
// 	void writeAttribute(String localName, Double value);
// 
// 	void writeAttribute(String localName, Integer value);
// 
// 	void writeText(String description);
// 
// 	void endElement();
// }
// 
// Path: src/main/java/de/graphml/writer/model/Graph.java
// public interface Graph{
// 	void writeStart(ElementWriter writer, String id);
// 	void writeEnd(ElementWriter writer);
// }
// 
// Path: src/main/java/de/graphml/writer/model/Key.java
// public interface Key {
// 	String getId();
// 	void writeTo(ElementWriter writer);
// }
// 
// Path: src/main/java/de/graphml/writer/model/Node.java
// public interface Node{
// 	void writeStart(ElementWriter writer, String id);
// 	void writeEnd(ElementWriter writer);
// }


// Path: src/main/java/de/graphml/writer/GraphWriter.java
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import de.graphml.writer.model.DefaultKeys;
import de.graphml.writer.model.Edge;
import de.graphml.writer.model.ElementWriter;
import de.graphml.writer.model.Graph;
import de.graphml.writer.model.Key;
import de.graphml.writer.model.Node;

		while (openElements > 0) {
			elementWriter.endElement();
		}
		try {
			xtw.writeEndDocument();
			xtw.flush();
			xtw.close();
		} catch (XMLStreamException e) {
			throw new RuntimeException(e);
		}
	}

	private class InternalWriter implements ElementWriter {

		@Override
		public void endElement() {
			if (openElements == 0) {
				throw new IllegalStateException("no open element found");
			}
			try {
				openElements--;
				xtw.writeEndElement();
			} catch (XMLStreamException e) {
				throw new RuntimeException(e);
			}
		}

		@Override
		public void writeText(String description) {
			try {
				xtw.writeCharacters(description);