How to edit bpmn xml targetNamespace?

Such bpmn xml file,if i want to edit its targetNamespace with bpmn methods or other js methods,what should i do?
Thank you.
2019-11-21_095935

Here’s an example of editing the target namespace on the definitions object: https://codesandbox.io/s/bpmn-js-edit-target-namespace-lul2o

I saw its just edit in definitions,so how can i let it to edit and change the result for xml?5747662815581

Have you tried bpmnJS.saveXML((err, xml) => console.log(xml))?

I just tried like this,this is what I want to be,thank you very much guys!

        const _this = this
        const bpmnjs = _this.bpmnModeler
        var definitions = bpmnjs.getDefinitions();
        definitions.set("targetNamespace", _this.params.category);
        bpmnjs._setDefinitions(definitions)
        _this.bpmnModeler.saveXML({ format: true }, function(err, xml) {
          console.log(xml)
       })
1 Like