Error: unknown type <\"dc:Point\"> when importing REST response into viewer

Hey everyone,

I’m having a strange problem using the bpmn-js viewer (importXML) with a process definition that I get via a XMLHttpRequest.response and some formatting from the REST engine (/engine-rest/process-definition/key/{key}/xml).

When I pass the response string to the viewer, I am getting errors like these:

could not parse node bpmn-viewer.js:4476 Error: unknown type <\"dc:Point\"> at Registry.mapTypes (http://localhost:8080/XXX/lib/bpmn-viewer.js:7550:11) at Registry.getEffectiveDescriptor (http://localhost:8080/XXX/lib/bpmn-viewer.js:7575:8) at Moddle.getType (http://localhost:8080/XXX/lib/bpmn-viewer.js:7130:32) at BaseHandler.ElementHandler.getPropertyForNode (http://localhost:8080/XXX/lib/bpmn-viewer.js:4189:29) at BaseHandler.ElementHandler.handleChild (http://localhost:8080/XXX/lib/bpmn-viewer.js:4256:23) at BaseHandler.BaseElementHandler.handleNode (http://localhost:8080/XXX/lib/bpmn-viewer.js:4076:19) at Object.handleOpen [as onopentag] (http://localhost:8080/XXX/lib/bpmn-viewer.js:4457:26) at emit (http://localhost:8080/XXX/lib/bpmn-viewer.js:5815:33) at emitNode (http://localhost:8080/XXX/lib/bpmn-viewer.js:5820:3) at openTag (http://localhost:8080/XXX/lib/bpmn-viewer.js:6001:3)

However, the response looks correct to me, and when I simply copy and paste my logging output of the response string and hardcode it as the input to the viewer, everything works fine.

As stated before, I am not a JS expert by any means. Is this some kind of string encoding problem? Any ideas?

Maybe someone could post a working example of passing a XMLHttpRequest to the viewer? I found myself doing string manipulations in my code, and I am sure this is not how I should do it.

Ok, for future reference:

solved the issue by using overrideMimeType(“application/json”) on the XMLHttpRequest before sending, then getting the “bpmn20Xml” property of the returned JSON.

Sigh.

Cheers