Skip to content

Commit 83428ef

Browse files
chore(deps): bump fast-xml-parser from 5.4.2 to 5.5.10 (#3494)
1 parent cb17da9 commit 83428ef

3 files changed

Lines changed: 72 additions & 32 deletions

File tree

package-lock.json

Lines changed: 56 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"dependencies": {
107107
"@typed-mxgraph/typed-mxgraph": "~1.0.8",
108108
"es-toolkit": "~1.45.0",
109-
"fast-xml-parser": "5.4.2",
109+
"fast-xml-parser": "5.5.10",
110110
"mxgraph": "4.2.2"
111111
},
112112
"devDependencies": {

src/component/parser/xml/BpmnXmlParser.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,25 @@ export default class BpmnXmlParser {
6868
*/
6969
processEntities: false,
7070

71-
// See https://github.com/NaturalIntelligence/fast-xml-parser/blob/v4.3.4/docs/v4/2.XMLparseOptions.md#attributevalueprocessor
72-
attributeValueProcessor: (name: string, value: string, nodePath: string): unknown => {
73-
if (isNumeric(name, nodePath)) {
71+
// Use Matcher object (jPath: false) to get paths without namespace prefixes via toString('.', false).
72+
// With jPath: true (default), toString() includes namespace prefixes (e.g. "bpmn:definitions.bpmndi:BPMNDiagram")
73+
// which don't match our expected paths in nodesWithNumericAttributes.
74+
jPath: false,
75+
76+
// See https://github.com/NaturalIntelligence/fast-xml-parser/blob/v5.5.7/docs/v4%2C%20v5/2.XMLparseOptions.md#attributevalueprocessor
77+
attributeValueProcessor: (attributeName: string, attributeValue: string, nodePathOrMatcher: unknown): unknown => {
78+
// nodePathOrMatcher is a Matcher instance (jPath: false) or a string (jPath: true). Get path without namespace prefixes.
79+
const nodePath =
80+
typeof nodePathOrMatcher === 'string' ? nodePathOrMatcher : (nodePathOrMatcher as { toString(separator?: string, includeNs?: boolean): string }).toString('.', false);
81+
82+
if (isNumeric(attributeName, nodePath)) {
7483
// The strnum lib used by fast-xml-parser is not able to parse all numbers
75-
// The only available options are https://github.com/NaturalIntelligence/fast-xml-parser/blob/v4.3.4/docs/v4/2.XMLparseOptions.md#numberparseoptions
84+
// The only available options are https://github.com/NaturalIntelligence/fast-xml-parser/blob/v5.5.7/docs/v4%2C%20v5/2.XMLparseOptions.md#numberparseoptions
7685
// This is a fix for https://github.com/process-analytics/bpmn-visualization-js/issues/2857
77-
return Number(value);
86+
return Number(attributeValue);
7887
}
7988

80-
return this.processAttribute(value);
89+
return this.processAttribute(attributeValue);
8190
},
8291
};
8392
private readonly xmlParser: XMLParser = new XMLParser(this.x2jOptions);

0 commit comments

Comments
 (0)