我最近将我的bpmn库更新为0.26.6版本。然而,现在我已经这样做了,我遇到了一个问题,我的图表。
由于某些原因,当将关系图解析为XML时,SequenceFlow对象似乎有一个附加的属性,如下所示:
<bpmn:sequenceFlow id="SequenceFlow_0itptjk" name="x===1" sourceRef="ExclusiveGateway_16fh3h3" targetRef="Task_10pxcz5" $type="bpmn:SequenceFlow">
<bpmn:conditionExpression language="JavaScript" xsi:type="bpmn:tFormalExpression">x===1</bpmn:conditionExpression>
</bpmn:sequenceFlow>问题是$type="bpmn:SequenceFlow“不是有效的XML,并且没有通过验证。
{
"name": "FlowElement",
"isAbstract": true,
"superClass": [
"BaseElement"
],
"properties": [
{
"name": "name",
"isAttr": true,
"type": "String"
},
{
"name": "auditing",
"type": "Auditing"
},
{
"name": "monitoring",
"type": "Monitoring"
},
{
"name": "categoryValueRef",
"type": "CategoryValue",
"isMany": true,
"isReference": true
}
]
},{
"name": "SequenceFlow",
"superClass": [
"FlowElement"
],
"properties": [
{
"name": "isImmediate",
"isAttr": true,
"type": "Boolean"
},
{
"name": "conditionExpression",
"type": "Expression",
"xml": {
"serialize": "xsi:type"
}
},
{
"name": "sourceRef",
"type": "FlowNode",
"isAttr": true,
"isReference": true
},
{
"name": "targetRef",
"type": "FlowNode",
"isAttr": true,
"isReference": true
}
]
},{
"name": "BaseElement",
"isAbstract": true,
"properties": [
{
"name": "id",
"isAttr": true,
"type": "String",
"isId": true
},
{
"name": "documentation",
"type": "Documentation",
"isMany": true
},
{
"name": "extensionDefinitions",
"type": "ExtensionDefinition",
"isMany": true,
"isReference": true
},
{
"name": "extensionElements",
"type": "ExtensionElements"
}
]
}正如您所看到的,所有这些都没有说明为什么要添加$type。
过去有没有人遇到过这个问题?
-编辑--
在进行了一些测试之后,似乎在将条件表达式添加到$type时添加了SequenceFlow参数。否则,将不添加该属性,并且XML是有效的。
-EDIT2 2--
以下是我使用的XML定义:
<bpmn:definitions id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">-EDIT3 3--
在进行更多故障排除后,将提供更多的详细信息。这个错误不仅影响条件流,而且影响到所有类型。此错误恰好发生在更新之后,该更新将在
UpdatePropertiesHandler.prototype.execute = function(context) ...在这个函数中,有一个调用
setProperties(businessObject, properties);在那套房子里,有个
function setProperties(businessObject, properties) {
forEach(properties, function(value, key) {
businessObject.set(key, value);
});
}在那个forEach之后,businessObject突然在它的$attrs中有了一个$type。就好像它没有做businessObject.set,而是在做businessObject.$attr.set。
发布于 2018-02-21 15:06:08
我找到了这个问题的原因。我使用的bpmn版本似乎与该项目用于将bpmn解析为xml的camunda版本不完全兼容。解决方案是一次将bpmn还原成一个版本,直到我找到一个兼容的版本,并且没有任何意外的属性被camunda错误地处理。
https://stackoverflow.com/questions/48835186
复制相似问题