-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Namespaces get removed when exporting foreign diagram #1310
Comments
Added basic reproducible test cases in bpmn-moddle as well as moddle-xml. We'll look into this. Our tools should not ever export invalid XML, no matter how cryptic / special the input XML is. |
@nikku thank you for looking into this! |
When trying to root cause this, I made an observation: Removing the unused namespace |
I've already root caused these things, too. See linked, focussed test cases attached. Regarding the namespaces and the specific example, what namespace exports would you expect? <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<definitions id="Definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" targetNamespace="http://bpmn.io">
<BPMNDiagram id="BPMNDiagram_1" xmlns="http://www.omg.org/spec/BPMN/20100524/DI">
<BPMNPlane bpmnElement="Definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/DI" />
</BPMNDiagram>
</definitions> |
As you mentioned, this is a different issue. |
The namespaces that are used in the model. In particular, the namespace prefixes |
So the export would look as imported? <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<definitions id="Definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" targetNamespace="http://bpmn.io">
<BPMNDiagram id="BPMNDiagram_1" xmlns="http://www.omg.org/spec/BPMN/20100524/DI">
<BPMNPlane bpmnElement="Definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/DI" />
</BPMNDiagram>
</definitions> Or should it drop the unused / not needed <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<definitions id="Definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" targetNamespace="http://bpmn.io">
<BPMNDiagram id="BPMNDiagram_1" xmlns="http://www.omg.org/spec/BPMN/20100524/DI">
<BPMNPlane bpmnElement="Definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/DI" />
</BPMNDiagram>
</definitions> |
Ideally, it looks like the imported: no namespace prefixes but If it is too hard to remember if the DI elements were prefixed or not, we could also export them always with prefix but also declare it properly. |
Thanks! Your feedback helps to move towards a usable solution. |
Just a thought: Maybe filtering out unused namespace prefix declaration before the import could help to focus on the right prefixes to remember for the export. |
This is an implementation detail we don't have to care about at this point. What is more important is the what and you've helped us tremendously setting that straight. When it comes to fixing this bug: We've queued it into our "tasks to work on" topic list. We do not have any concrete plans when it will be fixed. |
If you can not fix it any time soon, what could be a workaround, i.e. what could we ask CaseAgile to change in their export? Would it help if their tool would prefix the DI elements? It could save some file size, given how often the |
What is your time line, i.e. when would you need a fix? We'll not fix this right now but we'll look into this in an orderly manner, in the near future. |
CaseAgile could export their diagrams in the normal manner: <definitions xmlns:bpmndi="...">
<bpmndi:BPMNDiagram>...</bpmndi:BPMNDiagram>
</definitions> Rather than attaching the namespace on each element indivually AND writing the <definitions xmlns:bpmndi="...">
<BPMNDiagram xmlns="...">...</bpmndi:BPMNDiagram>
</definitions> But it is really a bug on our side we need to fix, too. |
This ensures that we always use the inner most form for namespace declarations in cases where namespaces are declared multiple times, with different prefixes: ```xml <root:complexNesting xmlns:root="http://properties" id="ComplexNesting"> <complexNesting xmlns="http://properties"> <complexNesting> <foo:complexNesting xmlns:foo="http://properties" /> </complexNesting> </complexNesting> </root:complexNesting> ``` Outer, unused declarations are still cleaned up accordingly, as this is our existing behavior. This means that we never export something like this (because we strip the global, unused declaration): ```xml <root xmlns="http://extended" xmlns:unused="http://properties" id="Root"> <base xmlns="http://properties" /> </root> ``` Related to bpmn-io/bpmn-js#1310
This adds a test that verifies that locally re-declared namespaces are kept (to keep diagram changes to a minimum). Related to bpmn-io/bpmn-js#1310
This ensures that we always use the inner most form for namespace declarations in cases where namespaces are declared multiple times, with different prefixes: ```xml <root:complexNesting xmlns:root="http://properties" id="ComplexNesting"> <complexNesting xmlns="http://properties"> <complexNesting> <foo:complexNesting xmlns:foo="http://properties" /> </complexNesting> </complexNesting> </root:complexNesting> ``` Outer, unused declarations are still cleaned up accordingly, as this is our existing behavior. This means that we never export something like this (because we strip the global, unused declaration): ```xml <root xmlns="http://extended" xmlns:unused="http://properties" id="Root"> <base xmlns="http://properties" /> </root> ``` Related to bpmn-io/bpmn-js#1310
This ensures that we always use the inner most form for namespace declarations in cases where namespaces are declared multiple times, with different prefixes: ```xml <root:complexNesting xmlns:root="http://properties" id="ComplexNesting"> <complexNesting xmlns="http://properties"> <complexNesting> <foo:complexNesting xmlns:foo="http://properties" /> </complexNesting> </complexNesting> </root:complexNesting> ``` Outer, unused declarations are still cleaned up accordingly, as this is our existing behavior. This means that we never export something like this (because we strip the global, unused declaration): ```xml <root xmlns="http://extended" xmlns:unused="http://properties" id="Root"> <base xmlns="http://properties" /> </root> ``` Related to bpmn-io/bpmn-js#1310
This adds a test that verifies that locally re-declared namespaces are kept (to keep diagram changes to a minimum). Related to bpmn-io/bpmn-js#1310
This ensures that we always use the inner most form for namespace declarations in cases where namespaces are declared multiple times, with different prefixes: ```xml <root:complexNesting xmlns:root="http://properties" id="ComplexNesting"> <complexNesting xmlns="http://properties"> <complexNesting> <foo:complexNesting xmlns:foo="http://properties" /> </complexNesting> </complexNesting> </root:complexNesting> ``` Outer, unused declarations are still cleaned up accordingly, as this is our existing behavior. This means that we never export something like this (because we strip the global, unused declaration): ```xml <root xmlns="http://extended" xmlns:unused="http://properties" id="Root"> <base xmlns="http://properties" /> </root> ``` Related to bpmn-io/bpmn-js#1310
This ensures that we always use the inner most form for namespace declarations in cases where namespaces are declared multiple times, with different prefixes: ```xml <root:complexNesting xmlns:root="http://properties" id="ComplexNesting"> <complexNesting xmlns="http://properties"> <complexNesting> <foo:complexNesting xmlns:foo="http://properties" /> </complexNesting> </complexNesting> </root:complexNesting> ``` Outer, unused declarations are still cleaned up accordingly, as this is our existing behavior. This means that we never export something like this (because we strip the global, unused declaration): ```xml <root xmlns="http://extended" xmlns:unused="http://properties" id="Root"> <base xmlns="http://properties" /> </root> ``` Related to bpmn-io/bpmn-js#1310
... (1) and (2). |
Just fyi, we'd also be interested in an eventual fix for this issue. Our viadee BPMN modeler for Confluence also uses bpmn-js and it'd make our participation in the miwg demo much easier. |
We're working on a fix and planning to merge the fix within this week. |
Closed via #1317 |
Awesome! Thank you! |
Describe the Bug
A diagram I exported from a different Modeler and afterwards imported into bpmn-js is not schema valid anymore as soon as I export it from bpmn-js.
This issue is coming from running tests for the upcoming bpmn miwg demo.
Fixtures
Advertise a job vacancy.original.edit.bpmn.zip
Steps to Reproduce
xmlns:dc
,xmlns:di
andxmlns:bpmndi
are part of<defintions>
saveXML
method of the bpmn-js instance to get the xmlxmlns:dc
,xmlns:di
andxmlns:bpmndi
attributes are not present in the definitions anymoreI tried to create a showcase: https://codesandbox.io/s/busy-dawn-eel38?file=/src/index.js just have a look at the console tab to see the different attributes before and after import+export.
Expected Behavior
I expected the 3 mentioned namespaces to still be inside definitions, so importing and exporting this model which was created in a different modeler is still schema-valid.
Impact
It's a blocker for the bpmn miwg demo because we cannot import models from CaseAgile and export them, to make the roundtrip.
Environment
Also tried Camunda Modeler 3.7, 4 and Cawemo and results are the same.
The text was updated successfully, but these errors were encountered: