我想生成一个像这样的BPMN XML文件:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn:process id="Process_1" isExecutable="false">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>SequenceFlow_1</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:task id="Task_1" name="Titulo111">
<bpmn:incoming>SequenceFlow_1</bpmn:incoming>
<extensionElements>abc</extensionElements>
</bpmn:task>
<bpmn:sequenceFlow id="SequenceFlow_1" sourceRef="StartEvent_1" targetRef="Task_1" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="173" y="102" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_1_di" bpmnElement="Task_1">
<dc:Bounds x="437" y="107" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1_di" bpmnElement="SequenceFlow_1">
<di:waypoint xsi:type="dc:Point" x="209" y="120" />
<di:waypoint xsi:type="dc:Point" x="323" y="120" />
<di:waypoint xsi:type="dc:Point" x="323" y="147" />
<di:waypoint xsi:type="dc:Point" x="437" y="147" />
<bpmndi:BPMNLabel>
<dc:Bounds x="278" y="123.5" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
有没有办法用JavaScript做到这一点?
我尝试使用createElement,但无法在“:”后设置属性,例如“
<bpmn:process ... ></bpmn:process>
”提前致谢。
最佳答案
看一下bpmn.io项目(http://bpmn.io/)。
它包括一个用于生成BPMN的JavaScript库以及一个建模和渲染模块(用于BPMN)。
关于javascript - 用Javascript生成BPMN XML,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31034046/