// Path: src/com/ganggarrison/gmdec/FileTools.java
// public class FileTools {
// 	public static void writeFile(File file, String content) throws IOException {
// 		writeFile(file, content.getBytes("UTF-8"));
// 	}
// 
// 	public static void writeFile(File file, byte[] content) throws IOException {
// 		// Never overwrite
// 		if (file.exists()) {
// 			throw new IOException("File " + file + " already exists.");
// 		}
// 
// 		FileOutputStream fos = null;
// 		DataOutputStream dos = null;
// 
// 		try {
// 			fos = new FileOutputStream(file);
// 			dos = new DataOutputStream(fos);
// 			dos.write(content);
// 		} finally {
// 			tryToClose(fos);
// 			tryToClose(dos);
// 		}
// 	}
// 
// 	/**
// 	 * Modify the given String so that it can be used as part of a filename
// 	 * without causing problems from illegal/special characters.
// 	 * 
// 	 * The result should be similar to the input, but isn't necessarily
// 	 * reversible. The implementation might change in the future, so don't rely
// 	 * on the output staying the same.
// 	 */
// 	public static String replaceBadChars(String name) {
// 		if (name == null || name.trim().isEmpty())
// 			return "_";
// 		name = name.trim();
// 		for (String badChar : badChars) {
// 			name = name.replace(badChar, "_");
// 		}
// 		return name;
// 	}
// 
// 	public static boolean isGoodFilename(String name) {
// 		if (name == null || name.trim().isEmpty())
// 			return false;
// 		if (!name.trim().equals(name)) {
// 			return false;
// 		}
// 		for (String s : badChars) {
// 			if (name.contains(s))
// 				return false;
// 		}
// 		return true;
// 	}
// 
// 	private static final String[] badChars = new String[] { "/", "\\", ":", "*", "?", "\"", "<", ">", "|", ".", "\0" };
// 
// 	public static String readFileAsString(File file) throws IOException {
// 		return new String(readWholeFileBytes(file), "UTF-8");
// 	}
// 
// 	public static byte[] readWholeFileBytes(File file) throws IOException {
// 		FileInputStream fis = null;
// 		DataInputStream dis = null;
// 		try {
// 			fis = new FileInputStream(file);
// 			dis = new DataInputStream(fis);
// 			byte[] buffer = new byte[(int) file.length()];
// 			dis.readFully(buffer);
// 
// 			return buffer;
// 		} finally {
// 			tryToClose(fis);
// 			tryToClose(dis);
// 		}
// 	}
// 
// 	private static void tryToClose(Closeable stream) {
// 		if (stream != null) {
// 			try {
// 				stream.close();
// 			} catch (IOException e) {
// 			}
// 		}
// 	}
// }


import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Stack;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Comment;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
import com.ganggarrison.gmdec.FileTools;
		String lineSep = System.getProperty("line.separator");
		System.setProperty("line.separator", "\n");
		try {
			Transformer trans = createTransformer();
			writeXml(trans, file);
		} catch (TransformerConfigurationException e) {
			throw new AssertionError(e);
		} catch (TransformerException e) {
			throw new IOException(e);
		} finally {
			System.setProperty("line.separator", lineSep);
		}

	}

	private Transformer createTransformer() throws TransformerConfigurationException {
		TransformerFactory transfac = TransformerFactory.newInstance();
		Transformer trans = transfac.newTransformer();
		trans.setOutputProperty(OutputKeys.INDENT, "yes");
		trans.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
		trans.setOutputProperty(OutputKeys.STANDALONE, "no");
		trans.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
		return trans;
	}

	private void writeXml(Transformer trans, File file) throws TransformerException, IOException {
		StringWriter sw = new StringWriter();
		StreamResult result = new StreamResult(sw);
		DOMSource source = new DOMSource(domDocument);
		trans.transform(source, result);
// Path: src/com/ganggarrison/gmdec/FileTools.java
// public class FileTools {
// 	public static void writeFile(File file, String content) throws IOException {
// 		writeFile(file, content.getBytes("UTF-8"));
// 	}
// 
// 	public static void writeFile(File file, byte[] content) throws IOException {
// 		// Never overwrite
// 		if (file.exists()) {
// 			throw new IOException("File " + file + " already exists.");
// 		}
// 
// 		FileOutputStream fos = null;
// 		DataOutputStream dos = null;
// 
// 		try {
// 			fos = new FileOutputStream(file);
// 			dos = new DataOutputStream(fos);
// 			dos.write(content);
// 		} finally {
// 			tryToClose(fos);
// 			tryToClose(dos);
// 		}
// 	}
// 
// 	/**
// 	 * Modify the given String so that it can be used as part of a filename
// 	 * without causing problems from illegal/special characters.
// 	 * 
// 	 * The result should be similar to the input, but isn't necessarily
// 	 * reversible. The implementation might change in the future, so don't rely
// 	 * on the output staying the same.
// 	 */
// 	public static String replaceBadChars(String name) {
// 		if (name == null || name.trim().isEmpty())
// 			return "_";
// 		name = name.trim();
// 		for (String badChar : badChars) {
// 			name = name.replace(badChar, "_");
// 		}
// 		return name;
// 	}
// 
// 	public static boolean isGoodFilename(String name) {
// 		if (name == null || name.trim().isEmpty())
// 			return false;
// 		if (!name.trim().equals(name)) {
// 			return false;
// 		}
// 		for (String s : badChars) {
// 			if (name.contains(s))
// 				return false;
// 		}
// 		return true;
// 	}
// 
// 	private static final String[] badChars = new String[] { "/", "\\", ":", "*", "?", "\"", "<", ">", "|", ".", "\0" };
// 
// 	public static String readFileAsString(File file) throws IOException {
// 		return new String(readWholeFileBytes(file), "UTF-8");
// 	}
// 
// 	public static byte[] readWholeFileBytes(File file) throws IOException {
// 		FileInputStream fis = null;
// 		DataInputStream dis = null;
// 		try {
// 			fis = new FileInputStream(file);
// 			dis = new DataInputStream(fis);
// 			byte[] buffer = new byte[(int) file.length()];
// 			dis.readFully(buffer);
// 
// 			return buffer;
// 		} finally {
// 			tryToClose(fis);
// 			tryToClose(dis);
// 		}
// 	}
// 
// 	private static void tryToClose(Closeable stream) {
// 		if (stream != null) {
// 			try {
// 				stream.close();
// 			} catch (IOException e) {
// 			}
// 		}
// 	}
// }


// Path: src/com/ganggarrison/easyxml/XmlWriter.java
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Stack;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Comment;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
import com.ganggarrison.gmdec.FileTools;

		String lineSep = System.getProperty("line.separator");
		System.setProperty("line.separator", "\n");
		try {
			Transformer trans = createTransformer();
			writeXml(trans, file);
		} catch (TransformerConfigurationException e) {
			throw new AssertionError(e);
		} catch (TransformerException e) {
			throw new IOException(e);
		} finally {
			System.setProperty("line.separator", lineSep);
		}

	}

	private Transformer createTransformer() throws TransformerConfigurationException {
		TransformerFactory transfac = TransformerFactory.newInstance();
		Transformer trans = transfac.newTransformer();
		trans.setOutputProperty(OutputKeys.INDENT, "yes");
		trans.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
		trans.setOutputProperty(OutputKeys.STANDALONE, "no");
		trans.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
		return trans;
	}

	private void writeXml(Transformer trans, File file) throws TransformerException, IOException {
		StringWriter sw = new StringWriter();
		StreamResult result = new StreamResult(sw);
		DOMSource source = new DOMSource(domDocument);
		trans.transform(source, result);
		FileTools.writeFile(file, sw.toString());