public static void saveXml(Node e, File out) throws Exception { FileOutputStream fo = new FileOutputStream(out); saveXml(e, fo); fo.close(); }
public static String toString(Node e, boolean intend) throws Exception { StringWriter sw = new StringWriter(); saveXml(e,sw,intend); return sw.toString(); }
public static void createDocument(XmlModel model, File file) throws Exception { Document doc = createXmlDocument(model); MXml.saveXml(doc.getDocumentElement(), file); }
public void writeConfig(Writer configStream,boolean intend) throws Exception { MXml.trim(element); MXml.saveXml(element, configStream, intend); }
public static void saveInto(XmlModel model, File file) throws Exception { if (!file.exists()) { createDocument(model, file); return; } Document doc = MXml.loadXml(file); Element eProcess = MXml.getElementByPath(doc.getDocumentElement(), "bpmn2:process"); for (Element child : MXml.getLocalElementIterator(eProcess)) eProcess.removeChild(child); model.createXml(eProcess); MXml.saveXml(doc.getDocumentElement(), file); }
@Override public InputStream rewriteContent(String file, InputStream in) throws Exception { if (!file.equals(SOfficeConnector.SOFFICE_CONTENT)) return in; Document content = MXml.loadXml(in); NodeList list = content.getDocumentElement().getElementsByTagName("text:user-field-decl"); for (int i = 0; i < list.getLength(); i++) { Element node = (Element) list.item(i); String name = node.getAttribute("text:name"); String value = values.getString(name, null); if (value != null) { node.setAttribute("office:string-value", value); } } StreamBuffer buffer = new StreamBuffer(); MXml.saveXml(content, buffer.getOutputStream()); return buffer.getInputStream(); }
public void save() throws MException { try { if (!canSave()) return; log().t("save config",this); FileOutputStream os = new FileOutputStream(file); MXml.trim(element); MXml.saveXml(element, os); os.close(); } catch (Exception e) { throw new MException(e); } }