I just did the same thing and the custom xmlns is getting added for me.
I’m sure you are doing this but when you open a new diagram to draw from does that diagram have your custom xmlns added (xmlns:cutomNs=“http://some-company/schema/bpmn/cutomNs”) or are you using the default?
I have not tried doing that but I think the answer is yes. You need to have your code add in the namespace for customNs. BPMN.io does not have the smarts to figure out that it needs to add in the namespace.
Hmmm I tried to recreate the issue today but it all seems to work correctly now Bpmn.io now adds the missing namespace if it is used anywhere.
Maybe it was something in our code or the fact that we recently upgraded to version 0.12.1.
And executing: renderer.definitions.set("xmlns:myNs", "http://...");
the modeler does NOT add the “xmlns:myNs” namespace to the exported XML.
Fot this namespace I’m also extending the modeler:
But… executing this: renderer.definitions.set("xmlns:dummyNs", "http://...");
the modeler does add the “xmlns:dummyNs” namespace to the exported XML.
In this case no moddleExtensions were defined.
It seems that the modeler does not allow manual insertion of namespaces that are defined with moddleExtensions. Does this seem possible?
With the last fix we allow the addition of custom namespaces. We still verify whether myNS is used because you defined it (via a meta-model extension).
To fix your issue we’d need to properly parse and recognize the namespace in ItemDefinition#structureRef (open bug).
If you have a well-defined namespace (meta-model extension) you may work around this by adding a custom extension element to the root element.