Open zhangleixp opened 2 years ago
Hello,
I have also problem with this part of 2.2 BpmnXMLUtil.parseChildElements(). Potential solution may fix both.
Problem noticed in 6.8.0.20
in xml model i have value like:
<![CDATA[some text which xtr is not providing at once]]
In while loop:
xtr.next() then xtr.getText() returns 'some text which xtr is not provi' which sets to extension element xtr.next() then xtr.getText() returns 'ding at once' which overrides extension element
So instead:
if (StringUtils.isNotEmpty(xtr.getText().trim())) {
extensionElement.setElementText(xtr.getText().trim());
}
I would prefer something like:
if (StringUtils.isNotEmpty(xtr.getText().trim())) {
if(extensionElement.getElementText() == null){
extensionElement.setElementText(xtr.getText());
} else {
extensionElement.setElementText(extensionElement.getElementText() + xtr.getText());
}
}
It would require not trimming or trimming on extension element return.
I noticed that my problem could be fixed by setting coalescing on XMLInputFactory at BpmnXMLConverter.convertToBpmnModel
if(xif.isPropertySupported(XMLInputFactory.IS_COALESCING)){
xif.setProperty(XMLInputFactory.IS_COALESCING, true);
}
but I do not understand potential implications of this
A year has passed, is there anyone who can help
1. Description
Bpmn xml text like this:
After convertion to json, the text is converted to
a>b
in elementb
, while expection is:a>b
.2. Reason
2.1 Behavior of XMLStreamReader
The XMLStreamReader treate entity references specially.
a>b
will report 3 times. I wrote a simple code:The output is:
We can see that,there is only a line
a>b
, but XMLStreamReader reported 3 times.2.2 BpmnXMLUtil.parseChildElements() only got the last reported text
Relatived code : https://github.com/flowable/flowable-engine/blob/d763b143d9b80b32ec8483fe6584429283e87e75/modules/flowable-bpmn-converter/src/main/java/org/flowable/bpmn/converter/util/BpmnXMLUtil.java#L190-L204
At line 195,
extensionElement.setElementText(xtr.getText().trim())
only got the last reported textb
.3. Suggestion
Modify L195 as: extensionElement.setElementText(extensionElement.getElementText() + xtr.getText().trim())
Please forgive me for my poor English.