When i export a diagram to SVG the resulting SVG XML has duplicate “xmlns” declarations on elements.
<g xmlns=\"http://www.w3.org/2000/svg\" class=\"djs-group\" xmlns=\"http://www.w3.org/2000/svg\">
The resulting SVG can not be opened by certain applications (IE, FF, Chrome…).
For example when exporting a simple diagram with just a start event here is what the saveSVG() method returns:
<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- created with bpmn-js / http://bpmn.io -->\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"48\" height=\"48\" viewBox=\"167 96 48 48\" version=\"1.1\"> <defs> <marker id=\"markerSimvund8r2i\" viewBox=\"0 0 20 20\" refX=\"11\" refY=\"10\" markerWidth=\"10\" markerHeight=\"10\" orient=\"auto\"> <path style=\"stroke-dasharray: 10000,1; stroke-linecap: round; stroke-width: 1;\" fill=\"#000000\" d=\"M 1 5 L 11 10 L 1 15 Z\"/> </marker> <marker id=\"markerSimvund8r2k\" viewBox=\"0 0 20 20\" refX=\"6\" refY=\"6\" markerWidth=\"20\" markerHeight=\"20\" orient=\"auto\"> <circle style=\"stroke-dasharray: 10000,1; stroke-linecap: round; stroke-width: 1;\" fill=\"#ffffff\" stroke=\"#000000\" cx=\"6\" cy=\"6\" r=\"3.5\"/> </marker> <marker id=\"markerSimvund8r2m\" viewBox=\"0 0 20 20\" refX=\"8.5\" refY=\"5\" markerWidth=\"20\" markerHeight=\"20\" orient=\"auto\"> <path style=\"stroke-dasharray: 10000,1; stroke-linecap: butt; stroke-width: 1;\" fill=\"#ffffff\" stroke=\"#000000\" d=\"m 1 5 l 0 -3 l 7 3 l -7 3 Z\"/> </marker> <marker id=\"markerSimvund8r2o\" viewBox=\"0 0 20 20\" refX=\"1\" refY=\"10\" markerWidth=\"10\" markerHeight=\"10\" orient=\"auto\"> <path style=\"stroke-dasharray: 10000,1; stroke-linecap: round; stroke-width: 1.5;\" fill=\"none\" stroke=\"#000000\" d=\"M 11 5 L 1 10 L 11 15\"/> </marker> <marker id=\"markerSimvund8r2q\" viewBox=\"0 0 20 20\" refX=\"12\" refY=\"10\" markerWidth=\"10\" markerHeight=\"10\" orient=\"auto\"> <path style=\"stroke-dasharray: 10000,1; stroke-linecap: round; stroke-width: 1.5;\" fill=\"none\" stroke=\"#000000\" d=\"M 1 5 L 11 10 L 1 15\"/> </marker> <marker id=\"markerSimvund8r2s\" viewBox=\"0 0 20 20\" refX=\"-1\" refY=\"10\" markerWidth=\"10\" markerHeight=\"10\" orient=\"auto\"> <path style=\"stroke-dasharray: 10000,1; stroke-linecap: round; stroke-width: 1;\" fill=\"#ffffff\" stroke=\"#000000\" d=\"M 0 10 L 8 6 L 16 10 L 8 14 Z\"/> </marker> <marker id=\"markerSimvund8r2u\" viewBox=\"0 0 20 20\" refX=\"-5\" refY=\"10\" markerWidth=\"10\" markerHeight=\"10\" orient=\"auto\"> <path style=\"stroke-dasharray: 10000,1; stroke-linecap: round; stroke-width: 1;\" fill=\"#000000\" stroke=\"#000000\" d=\"M 1 4 L 5 16\"/> </marker> </defs><g xmlns=\"http://www.w3.org/2000/svg\" class=\"djs-group\" xmlns=\"http://www.w3.org/2000/svg\"> <g class=\"djs-element djs-shape\" style=\"display: block;\" transform=\"matrix(1 0 0 1 173 102)\" data-element-id=\"StartEvent_1\"> <g class=\"djs-visual\"> <circle style=\"stroke-width: 2;\" fill=\"#ffffff\" stroke=\"#000000\" cx=\"18\" cy=\"18\" r=\"18\" /> </g> <rect class=\"djs-hit\" style=\"stroke-opacity: 0; stroke-width: 15;\" fill=\"none\" stroke=\"#ffffff\" x=\"0\" y=\"0\" width=\"36\" height=\"36\" /> <rect class=\"djs-outline\" fill=\"none\" x=\"-6\" y=\"-6\" width=\"48\" height=\"48\" /> </g> </g><g xmlns=\"http://www.w3.org/2000/svg\" class=\"djs-group\" xmlns=\"http://www.w3.org/2000/svg\"> <g class=\"djs-element djs-shape\" style=\"display: none;\" transform=\"matrix(1 0 0 1 146 138)\" data-element-id=\"StartEvent_1_label\"> <g class=\"djs-visual\"> <text class=\" djs-label\" style=\"font-family: Arial, sans-serif; font-size: 11px;\"> <tspan x=\"45\" y=\"0\" /> </text> </g> <rect class=\"djs-hit\" style=\"stroke-opacity: 0; stroke-width: 15;\" fill=\"none\" stroke=\"#ffffff\" x=\"0\" y=\"0\" width=\"90\" height=\"20\" /> <rect class=\"djs-outline\" fill=\"none\" x=\"-6\" y=\"-6\" width=\"102\" height=\"32\" /> </g> </g> </svg>
This only happens in IE for me (IE11).
When I call the same method using Chrome or Firefox the resulting SVG XML does not have this duplicate declarations.