@Override
	public void dump(CopperDumpType type, PrintStream out)
	throws IOException,	UnsupportedOperationException
	{
		if(type != CopperDumpType.HTML && type != CopperDumpType.XML) throw new UnsupportedOperationException(getClass().getName() + " only supports dump type " + CopperDumpType.HTML + " and " + CopperDumpType.XML);
			
		TransformerFactory tFactory = TransformerFactory.newInstance();
		Transformer transformer = null;
		  
		try
		{
			transformer = tFactory.newTransformer();
		}
		catch (TransformerConfigurationException e)
		{
			throw new IOException(e);
		}

		generateXMLDump();

		DOMSource source = new DOMSource(document);

		switch(type)
		{
		case HTML:
			StreamSource xslt = new StreamSource(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("etc/dumpformat.xml")));
			TransformerFactory fact = TransformerFactory.newInstance();
			Transformer tr = null;
			try { tr = fact.newTransformer(xslt); }
			catch(TransformerException ex) { throw new IOException(ex); }
			StringWriter wr = new StringWriter();
			StreamResult output = new StreamResult(wr);
			try { tr.transform(source,output); }
			catch(TransformerException ex) { throw new IOException(ex); }
			out.print(wr.toString());
			break;
		case XML:
			StreamResult result = new StreamResult(new PrintWriter(out));
			try
			{
				transformer.transform(source, result);
			}
			catch (TransformerException e)
			{
				throw new IOException(e);
			}
		default:
			break;		
		}

	}