public static String getValue(Element root, String path, String def) { Element ele = getElementByPath(root, path); if (ele == null) return def; return getValue(ele, false); }
@Override public IConfig getNode(String key) { Element e = MXml.getElementByPath(element, key); if (e == null) return null; return new XmlConfig(this, e); }
public static void load(XmlModel model, File file) throws Exception { Document doc = MXml.loadXml(file); Element eProcess = MXml.getElementByPath(doc.getDocumentElement(), "bpmn2:process"); model.load(eProcess); }
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); }
public Artifact(Element xml) { if ("project".equals(xml.getNodeName())) { Element parent = MXml.getElementByPath(xml, "parent"); if (parent != null) { groupId = MXml.getValue(parent, "groupId", groupId); version = MXml.getValue(parent, "version", version); } } artifactId = MXml.getValue(xml, "artifactId", artifactId); groupId = MXml.getValue(xml, "groupId", groupId); version = MXml.getValue(xml, "version", version); type = MXml.getValue(xml, "packaging", type); if (type == null) type = MXml.getValue(xml, "type", null); if (type.equals("bundle")) type = "jar"; }