feat(parser): let configure XML attribute processing #2704
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remove the 'entities' dependency.
By default, there is no need to be able to decode all entities as most of the time, only 'basic' entities are generally used in BPMN sources. Instead,
bpmn-visualization
now provides a small set of entities transform.If there is a need to transform more entities, a new Parser option is now available to let application perform more processing.
closes #2680
Notes
Choice of the decoded entities
The minimal set of entities was chosen by checking
mxGraph
implementation https://github.com/jgraph/mxgraph/blob/v4.2.2/javascript/src/js/util/mxUtils.js?rgh-link-date=2023-05-11T12%3A44%3A35Z#L736-L762fast-xml-parser
implementation https://github.com/NaturalIntelligence/fast-xml-parser/blob/c7b3cea4ead020c21d39e135a50348208829e971/src/xmlparser/OrderedObjParser.js#L22-L43Tests
The existing unit tests already check the most common entities in the name attribute of the element in the semantic (used to display the label) and in all other attributes (standard like the 'id' attribute or in attributes of BPMN extensions).
Integration tests were added in this PR to ensure that the options passed at the lib initialization are correctly used by the parser.
Bundles size comparison
master: package built by GH Actions (007d881)
new implementation: 823b786
bpmn-visualization.min.js
size decrease: 1941b / 1.89kbFigures from the study done without implementation the internal entities decoding (#2680): 2736b / 2.67kb