List of usage examples for org.dom4j DocumentFactory getInstance
public static synchronized DocumentFactory getInstance()
From source file:org.evosuite.ClientProcess.java
License:Open Source License
private static void handleShadingSpecialCases() { String shadePrefix = PackageInfo.getShadedPackageForThirdPartyLibraries() + "."; if (!DocumentFactory.class.getName().startsWith(shadePrefix)) { //if not shaded (eg in system tests), then nothing to do return;/*w w w. java2s . c o m*/ } String defaultFactory = System.getProperty("org.dom4j.factory", "org.dom4j.DocumentFactory"); String defaultDomSingletonClass = System.getProperty("org.dom4j.dom.DOMDocumentFactory.singleton.strategy", "org.dom4j.util.SimpleSingleton"); String defaultSingletonClass = System.getProperty("org.dom4j.DocumentFactory.singleton.strategy", "org.dom4j.util.SimpleSingleton"); System.setProperty("org.dom4j.factory", shadePrefix + defaultFactory); System.setProperty("org.dom4j.dom.DOMDocumentFactory.singleton.strategy", shadePrefix + defaultDomSingletonClass); System.setProperty("org.dom4j.DocumentFactory.singleton.strategy", shadePrefix + defaultSingletonClass); DocumentFactory.getInstance(); //force loading DOMDocumentFactory.getInstance(); //restore in case SUT uses its own dom4j System.setProperty("org.dom4j.factory", defaultFactory); System.setProperty("org.dom4j.dom.DOMDocumentFactory.singleton.strategy", defaultDomSingletonClass); System.setProperty("org.dom4j.DocumentFactory.singleton.strategy", defaultSingletonClass); }
From source file:org.foxbpm.bpmn.converter.BoundaryEventXMLConverter.java
License:Apache License
public Element cretateXMLElement() { return DocumentFactory.getInstance().createElement( BpmnXMLConstants.BPMN2_PREFIX + ':' + BpmnXMLConstants.ELEMENT_BOUNDARYEVENT, BpmnXMLConstants.BPMN2_NAMESPACE); }
From source file:org.foxbpm.bpmn.converter.BpmnXMLConverter.java
License:Apache License
/** * bpmnModel??documnet//from w w w. ja v a 2 s. com * * @param model * bpmn */ public Document convertToXML(BpmnModel model) { if (null == model) { throw new BpmnConverterException("?XML?!"); } DocumentFactory factory = DocumentFactory.getInstance(); Document doc = factory.createDocument(); Element element = factory.createElement( BpmnXMLConstants.BPMN2_PREFIX + ':' + BpmnXMLConstants.ELEMENT_DEFINITIONS, BpmnXMLConstants.BPMN2_NAMESPACE); element.addNamespace(BpmnXMLConstants.XSI_PREFIX, BpmnXMLConstants.XSI_NAMESPACE); element.addNamespace(BpmnXMLConstants.DC_PREFIX, BpmnXMLConstants.DC_NAMESPACE); element.addNamespace(BpmnXMLConstants.DI_PREFIX, BpmnXMLConstants.DI_NAMESPACE); element.addNamespace(BpmnXMLConstants.BPMNDI_PREFIX, BpmnXMLConstants.BPMNDI_NAMESPACE); element.addNamespace(BpmnXMLConstants.FOXBPM_PREFIX, BpmnXMLConstants.FOXBPM_NAMESPACE); element.addNamespace(BpmnXMLConstants.XSD_PREFIX, BpmnXMLConstants.XSD_NAMESPACE); element.addNamespace(BpmnXMLConstants.EMPTY_STRING, BpmnXMLConstants.XMLNS_NAMESPACE); // element.addAttribute(BpmnXMLConstants.TARGET_NAMESPACE_ATTRIBUTE, BpmnXMLConstants.XMLNS_NAMESPACE); element.addAttribute(BpmnXMLConstants.ATTRIBUTE_ID, "Definitions_1"); doc.add(element); // ?? try { for (Iterator<Process> iterator = model.getProcesses().iterator(); iterator.hasNext();) { ProcessExport.writeProcess(iterator.next(), element); } // ???? BPMNDIExport.writeBPMNDI(model, element); } catch (Exception e) { LOGGER.error("?XML???" + model.getProcesses().get(0).getName(), e); if (e instanceof BpmnConverterException) { throw (BpmnConverterException) e; } else { throw new BpmnConverterException( "?XML???" + model.getProcesses().get(0).getName(), e); } } return doc; }
From source file:org.foxbpm.bpmn.converter.CallActivityXMLConverter.java
License:Apache License
public Element cretateXMLElement() { return DocumentFactory.getInstance().createElement( BpmnXMLConstants.BPMN2_PREFIX + ':' + BpmnXMLConstants.ELEMENT_CALLACTIVITY, BpmnXMLConstants.BPMN2_NAMESPACE); }
From source file:org.foxbpm.bpmn.converter.EndEventXMLConverter.java
License:Apache License
public Element cretateXMLElement() { return DocumentFactory.getInstance().createElement( BpmnXMLConstants.BPMN2_PREFIX + ':' + BpmnXMLConstants.ELEMENT_ENDEVENT, BpmnXMLConstants.BPMN2_NAMESPACE); }
From source file:org.foxbpm.bpmn.converter.ExclusiveGatewayXMLConverter.java
License:Apache License
public Element cretateXMLElement() { return DocumentFactory.getInstance().createElement( BpmnXMLConstants.BPMN2_PREFIX + ':' + BpmnXMLConstants.ELEMENT_EXCLUSIVEGATEWAY, BpmnXMLConstants.BPMN2_NAMESPACE); }
From source file:org.foxbpm.bpmn.converter.InclusiveGatewayXMLConverter.java
License:Apache License
public Element cretateXMLElement() { return DocumentFactory.getInstance().createElement( BpmnXMLConstants.BPMN2_PREFIX + ':' + BpmnXMLConstants.ELEMENT_INCLUSIVEGATEWAY, BpmnXMLConstants.BPMN2_NAMESPACE); }
From source file:org.foxbpm.bpmn.converter.IntermediateCatchEventXMLConverter.java
License:Apache License
public Element cretateXMLElement() { return DocumentFactory.getInstance().createElement( BpmnXMLConstants.BPMN2_PREFIX + ':' + BpmnXMLConstants.ELEMENT_INTERMEDIATECATCHEVENT, BpmnXMLConstants.BPMN2_NAMESPACE); }
From source file:org.foxbpm.bpmn.converter.ParallelGatewayXMLConverter.java
License:Apache License
public Element cretateXMLElement() { return DocumentFactory.getInstance().createElement( BpmnXMLConstants.BPMN2_PREFIX + ':' + BpmnXMLConstants.ELEMENT_PARALLELGATEWAY, BpmnXMLConstants.BPMN2_NAMESPACE); }
From source file:org.foxbpm.bpmn.converter.ScriptTaskXMLConverter.java
License:Apache License
public Element cretateXMLElement() { return DocumentFactory.getInstance().createElement( BpmnXMLConstants.BPMN2_PREFIX + ':' + BpmnXMLConstants.ELEMENT_SCRIPTTASK, BpmnXMLConstants.BPMN2_NAMESPACE); }