public void saveXml() {
		if (!vermilionCascadeNotebook.getModified()) {
			return;
		}

		File file = new File(VCNConstants.WORK_FILE_PATH);

		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = null;

		try {
			builder = factory.newDocumentBuilder();

			Document xml = builder.newDocument();

			vermilionCascadeNotebook.flushEditor();

			constructXml(xml);
			
			System.out.println("Write data.xml..");
			Transformer t = TransformerFactory.newInstance().newTransformer();

			// t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "");
			// t.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "");

			t.setOutputProperty(OutputKeys.INDENT, "yes");
			t.setOutputProperty(OutputKeys.METHOD, "xml");

			t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");

			FileOutputStream fos = new FileOutputStream(file);
			StreamResult sr = new StreamResult(fos);
			t.transform(new DOMSource(xml), sr);

			fos.flush();
			fos.close();

			System.out.println("Write data.xml.");
		} catch (Exception ex) {
			VermilionCascadeNotebook.getInstance().setInModified();
			UI.messageDialog(VermilionCascadeNotebook.getInstance().getShell(), "Error writing user data '" + ex + 
					"'\r\nRecent modifictions were not saved\r\n", 
					"Writing user data process has caused an error: " + ex +"\r\nError stack: \r\n\r\n" + GeneralUtils.getStackTrace(ex));
			
			ex.printStackTrace();
		}

		VermilionCascadeNotebook.getInstance().setInModified();
	}