private void write(final Document document) throws IOException, TransformerException {
		TransformerFactory transformerFactory = TransformerFactory.newInstance();
		Transformer transformer = transformerFactory.newTransformer();
		transformer.setOutputProperty(OutputKeys.INDENT, "yes");
		transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
		transformer
				.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://cobertura.sourceforge.net/xml/coverage-04.dtd");
		try (BufferedWriter bufferedWriter = Files.newBufferedWriter(this.reportPath)) {
			transformer.transform(new DOMSource(document), new StreamResult(bufferedWriter));
		}
	}
private void write ( final Document document ) throws IOException , TransformerException { TransformerFactory transformerFactory = TransformerFactory . newInstance ( ) ; Transformer transformer = transformerFactory . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; transformer . setOutputProperty ( "{http://xml.apache.org/xslt}indent-amount" , "2" ) ; transformer . setOutputProperty ( OutputKeys . DOCTYPE_SYSTEM , "http://cobertura.sourceforge.net/xml/coverage-04.dtd" ) ; try ( BufferedWriter bufferedWriter = Files . newBufferedWriter ( this . reportPath ) ) { transformer . transform ( new DOMSource ( document ) , new StreamResult ( bufferedWriter ) ) ; } }
XML書き込み

@param document xml document
@throws IOException IOエラー
@throws TransformerException XML書き込みエラー