Skip to content

Commit 0483058

Browse files
committed
fix impl
1 parent ee1205c commit 0483058

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/component/parser/xml/BpmnXmlParser.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,20 @@ export default class BpmnXmlParser {
6868
*/
6969
processEntities: false,
7070

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+
7176
// See https://github.com/NaturalIntelligence/fast-xml-parser/blob/v5.5.7/docs/v4%2C%20v5/2.XMLparseOptions.md#attributevalueprocessor
72-
// jPath Parameter: The third parameter is either a string (when jPath: true, default) or a Matcher instance (when jPath: false).
7377
attributeValueProcessor: (attributeName: string, attributeValue: string, nodePathOrMatcher: unknown): unknown => {
74-
if (typeof nodePathOrMatcher === 'string' && isNumeric(attributeName, nodePathOrMatcher)) {
78+
// nodePathOrMatcher is a Matcher instance (jPath: false). Get path without namespace prefixes.
79+
const nodePath =
80+
typeof nodePathOrMatcher === 'object' && nodePathOrMatcher !== null
81+
? String((nodePathOrMatcher as { toString(separator?: string, includeNs?: boolean): string }).toString('.', false))
82+
: String(nodePathOrMatcher);
83+
84+
if (isNumeric(attributeName, nodePath)) {
7585
// The strnum lib used by fast-xml-parser is not able to parse all numbers
7686
// The only available options are https://github.com/NaturalIntelligence/fast-xml-parser/blob/v4.3.4/docs/v4/2.XMLparseOptions.md#numberparseoptions
7787
// This is a fix for https://github.com/process-analytics/bpmn-visualization-js/issues/2857

0 commit comments

Comments
 (0)