Hi,
I have a service that saves BPMN XML to a database, however I want to get access to the process id and name attributes to store this separately along with the XML in a table. When I use moddle to read the xml definitions I get the following warnings:
could not parse node reader.js:618 Error: id <sample-diagram> already used(…)
The definitions are also undefined.
function MyService(bpmnjs) {
this._bpmnjs = bpmnjs;
}
module.exports = MyService;
MyService.$inject = ['bpmnjs']
MyService.prototype.save = function() {
var self = this;
self._bpmnjs.saveXML({ format: true }, function (err, xml) {
if (err) {
console.error(err);
} else {
self._bpmnjs.moddle.fromXML(xml, function (err, definitions) {
console.log(definitions);
// I want to get the values of the process id and name here...
});
}
}
}
Is there a way to get access to these attributes without using moddle that I am unaware of?
I have tried the following moddle.fromXML(xml, 'bpmn:Process', function (err, process) {});
but it just says can’t parse node and process is undefined.
Any tips much appreciated, as I might be going about it the wrong way.
Thanks