private static boolean updateXML(Document document, String path) throws TransformerException {
		TransformerFactory factory = TransformerFactory.newInstance();
		Transformer transformer = factory.newTransformer();

		// out put encoding.
		transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
		
		transformer.setOutputProperty(OutputKeys.INDENT, "yes");

		DocumentType type = document.getDoctype();
		if (type != null) {
			System.out.println("doctype -->" + type.getPublicId());
			transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, type.getPublicId());
			transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, type.getSystemId());
		}
		
		DOMSource source = new DOMSource(document);
		StreamResult result = new StreamResult(new File(path));
		transformer.transform(source, result);

		transformer.reset();
		return true;
	}