我想生成一个BPMN文件,如下所示:
<?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>“
提前谢谢。
发布于 2015-06-25 18:39:47
看看bpmn.io项目(http://bpmn.io/)。它包括一个生成BPMN的javascript库以及一个建模和渲染模块(用于BPMN)。
发布于 2015-06-30 15:01:51
FYI:冒号字符前面的文本表示XML名称空间(在本例中为bpmn),因此需要确保将其添加到XML根元素:xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"中。
您可能需要查看这个文章 (引用自此原始员额),以获得有关如何在JS中创建具有名称空间的XML的更多信息。
希望这能帮上忙
https://stackoverflow.com/questions/31034046
复制相似问题