// Path: src/main/java/com/ojn/gexf4j/core/Gexf.java
// public interface Gexf {
// 
// 	String getVersion();
// 	
// 	boolean hasVariant();
// 	Gexf clearVariant();
// 	String getVariant();
// 	Gexf setVariant(String variant);
// 	
// 	Metadata getMetadata();
// 	
// 	Graph getGraph();
// 	
// 	boolean hasVisualization();
// 	Gexf setVisualization(boolean viz);
// }
// 
// Path: src/main/java/com/ojn/gexf4j/core/GexfWriter.java
// public interface GexfWriter {
// 
// 	void writeToStream(Gexf gexf, OutputStream out) throws IOException;
// }
// 
// Path: src/main/java/com/ojn/gexf4j/core/impl/writer/GexfEntityWriter.java
// public class GexfEntityWriter extends AbstractEntityWriter<Gexf> {
// 	private static final String ENTITY = "gexf";
// 	private static final String ATTRIBUTE_VERSION = "version";
// 	private static final String ATTRIBUTE_VARIANT = "variant";
// 	private static final String XMLNS_URL = "http://www.gexf.net/1.1draft";
// 	private static final String XMLNS_VIZ = "viz";
// 	private static final String XMLNS_VIZ_URL = "http://www.gexf.net/1.1draft/viz";
//     
// 	public GexfEntityWriter(XMLStreamWriter writer, Gexf entity) {
// 		super(writer, entity);
// 		write();
// 	}
// 
// 	@Override
// 	protected String getElementName() {
// 		return ENTITY;
// 	}
// 
// 	@Override
// 	protected void writeAttributes() throws XMLStreamException {
// 		writer.writeAttribute(
// 				ATTRIBUTE_VERSION,
// 				entity.getVersion());
// 		
// 		if (entity.hasVariant()) {
// 			writer.writeAttribute(
// 					ATTRIBUTE_VARIANT,
// 					entity.getVariant());
// 		}
// 	}
// 
// 	@Override
// 	protected void writeStartElement() throws XMLStreamException {
// 		writer.writeStartElement(getElementName());
// 		writer.writeDefaultNamespace(XMLNS_URL);
// 		
// 		if (entity.hasVisualization()) {
// 			writer.writeNamespace(XMLNS_VIZ, XMLNS_VIZ_URL);
// 		}
// 	}
// 
// 	@Override
// 	protected void writeElements() throws XMLStreamException {
// 		new MetadataEntityWriter(writer, entity.getMetadata());
// 		new GraphEntityWriter(writer, entity.getGraph());
// 	}
// }


import java.io.IOException;
import java.io.OutputStream;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import com.ojn.gexf4j.core.Gexf;
import com.ojn.gexf4j.core.GexfWriter;
import com.ojn.gexf4j.core.impl.writer.GexfEntityWriter;
package com.ojn.gexf4j.core.impl;




public class StaxGraphWriter implements GexfWriter {

	@Override
	public void writeToStream(Gexf gexf, OutputStream out) throws IOException {
		try {
			XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
			XMLStreamWriter writer = outputFactory.createXMLStreamWriter(out);
			
			writer.writeStartDocument("1.0");
			
// Path: src/main/java/com/ojn/gexf4j/core/Gexf.java
// public interface Gexf {
// 
// 	String getVersion();
// 	
// 	boolean hasVariant();
// 	Gexf clearVariant();
// 	String getVariant();
// 	Gexf setVariant(String variant);
// 	
// 	Metadata getMetadata();
// 	
// 	Graph getGraph();
// 	
// 	boolean hasVisualization();
// 	Gexf setVisualization(boolean viz);
// }
// 
// Path: src/main/java/com/ojn/gexf4j/core/GexfWriter.java
// public interface GexfWriter {
// 
// 	void writeToStream(Gexf gexf, OutputStream out) throws IOException;
// }
// 
// Path: src/main/java/com/ojn/gexf4j/core/impl/writer/GexfEntityWriter.java
// public class GexfEntityWriter extends AbstractEntityWriter<Gexf> {
// 	private static final String ENTITY = "gexf";
// 	private static final String ATTRIBUTE_VERSION = "version";
// 	private static final String ATTRIBUTE_VARIANT = "variant";
// 	private static final String XMLNS_URL = "http://www.gexf.net/1.1draft";
// 	private static final String XMLNS_VIZ = "viz";
// 	private static final String XMLNS_VIZ_URL = "http://www.gexf.net/1.1draft/viz";
//     
// 	public GexfEntityWriter(XMLStreamWriter writer, Gexf entity) {
// 		super(writer, entity);
// 		write();
// 	}
// 
// 	@Override
// 	protected String getElementName() {
// 		return ENTITY;
// 	}
// 
// 	@Override
// 	protected void writeAttributes() throws XMLStreamException {
// 		writer.writeAttribute(
// 				ATTRIBUTE_VERSION,
// 				entity.getVersion());
// 		
// 		if (entity.hasVariant()) {
// 			writer.writeAttribute(
// 					ATTRIBUTE_VARIANT,
// 					entity.getVariant());
// 		}
// 	}
// 
// 	@Override
// 	protected void writeStartElement() throws XMLStreamException {
// 		writer.writeStartElement(getElementName());
// 		writer.writeDefaultNamespace(XMLNS_URL);
// 		
// 		if (entity.hasVisualization()) {
// 			writer.writeNamespace(XMLNS_VIZ, XMLNS_VIZ_URL);
// 		}
// 	}
// 
// 	@Override
// 	protected void writeElements() throws XMLStreamException {
// 		new MetadataEntityWriter(writer, entity.getMetadata());
// 		new GraphEntityWriter(writer, entity.getGraph());
// 	}
// }


// Path: src/main/java/com/ojn/gexf4j/core/impl/StaxGraphWriter.java
import java.io.IOException;
import java.io.OutputStream;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import com.ojn.gexf4j.core.Gexf;
import com.ojn.gexf4j.core.GexfWriter;
import com.ojn.gexf4j.core.impl.writer.GexfEntityWriter;

package com.ojn.gexf4j.core.impl;




public class StaxGraphWriter implements GexfWriter {

	@Override
	public void writeToStream(Gexf gexf, OutputStream out) throws IOException {
		try {
			XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
			XMLStreamWriter writer = outputFactory.createXMLStreamWriter(out);
			
			writer.writeStartDocument("1.0");
			
			new GexfEntityWriter(writer, gexf);