Parse error when namespace declarations not exact

If the namespace declarations are not exactly “correct” the result is a parsing error. For example, we have gotten a file from a user where the namespaces are declared with https instead of http.

The result is a parse error and console

Error: “failed to parse document as bpmn:Definitions
C index.esm.js:63
fromXML index.esm.js:868
app.js:93:10
imported with warnings app.js:106:10

diagram(1).bpmn (854 Bytes)

What project are you referring to?

I’m not sure, BPMN I guess. The problem can be duplicated at https://demo.bpmn.io/ by trying to Open the attached bpmn file “diagram(1).bpmn”.

How did you end up with a diagram with that namespace URI?

A similar file was received from a user, not sure where he got it from but it does have the following attributes: exporter=“bpmn-js (https://demo.bpmn.io)”
exporterVersion=“4.0.3”

Not sure how he/she ended up with that diagram. As you mention it has wrong namespace URIs for the BPMN, BPMNDI and DC schemata. So whatever tool that diagram went through, it changed all URLs to https without knowing what that means.

We do not generate such broken diagrams. Any tool in the processing chain could do that though. It is also not required to override the exporter and exporterVersion attributes.

Wrong:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions  
 xmlns:bpmn="https://www.omg.org/spec/BPMN/20100524/MODEL" 
 xmlns:bpmndi="https://www.omg.org/spec/BPMN/20100524/DI" 
 xmlns:dc="https://www.omg.org/spec/DD/20100524/DC" 
 id="Definitions_18vnora" 
 targetNamespace="https://bpmn.io/schema/bpmn" 
 exporter="bpmn-js (https://demo.bpmn.io)" 
 exporterVersion="4.0.3">
...

Correct:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions  
 xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" 
 xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" 
 xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" 
 id="Definitions_18vnora" 
 targetNamespace="http://bpmn.io/schema/bpmn" 
 exporter="bpmn-js (https://demo.bpmn.io)" 
 exporterVersion="4.0.3">
...
1 Like