draw.io schemas

2,696 views
Skip to first unread message

Geoffrey Hill - Tutamantic

unread,
Sep 30, 2018, 6:58:22 AM9/30/18
to dra...@googlegroups.com

I am looking for more documentation on the xml schemas of the draw.io output formats. I have created a parser for the draw.io diagrams but am only guessing at the schema based on the examples I have created and downloaded. 

 

This is obviously a sub-optimal plan of action for me because I have no idea if I am actually correct in my assumptions. I would like to be more confirmed that a new diagram won’t break my parser.

 

I also noticed that the draw.io team changed its schema in the last few months and this broke my parser.  Does the core team plan on:

  1. Producing documentation for the schema(s) so I can check against them
  2. Notifying us of any changes to the schema(s) so my parser won’t break again?

 

Many thanks for any help.

 

Geoff

Tutamantic

David Benson

unread,
Sep 30, 2018, 7:10:02 AM9/30/18
to draw.io
It's good question. We definitely need to formally write down the structure of the XML, we started that, but it was paused. We have to support very old models on on-premise instances, so it should be backwards compatible at all time.

Exactly what broke in this case?

Geoffrey Hill - Tutamantic

unread,
Sep 30, 2018, 7:33:31 AM9/30/18
to David Benson, draw.io

From the top of my head it was the way you originally used ‘mxcell’ nodes to portray some objects (connectors), but then you also had ‘object’ nodes to portray them also (shapes).

 

I am trying to create a set of linked objects in memory, e.g. a ‘shape’ then ‘connector’ then ‘shape’ again, etc. I’m doing this for all of the connected shapes in the diagram. I have added name/value pairs to each of the shapes and connectors, and my code parses through these chains and collects the name/value pairs from each shape and connector. I then do some further analysis processing.

 

The draw.io schema makes it challenging for me to get the data from the shapes and connectors because I needed to differentiate between the shapes and connectors. I did this a while back and everything worked ok.

 

But it seemed that the schema changed in the last few months and my parser failed to get the information from the connectors because my routine was unable to find the proper nodes.

 

I finally went back and created a number of new diagrams (using the same layouts as the older ones) to figure out what the changes were and I fixed the issue.  It seems that draw.io changed the relationship between ‘mxcell’ and ‘object’. It seems that draw.io changes a ‘mxcell’ to an ‘object’ when I add the name/value pair data to any shape or connector.

 

I still don’t know for sure if I am parsing the xml correctly. It seems to be working at the moment, but I have no way to verify.

 

My challenge is that I am trying to bring forward my product and I need some way to be informed of any changes before they break my parser. Many of my customers use draw.io and I want to cater to them. Is there any way to get informed of schema changes before they happen so I don’t have embarrassing broken parser issues?

 

 

Geoffrey Hill     Tutamantic

--
You received this message because you are subscribed to the Google Groups "draw.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drawio+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/drawio/cd15f939-a231-4494-833d-98c280f7375c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Benson

unread,
Sep 30, 2018, 7:52:46 AM9/30/18
to draw.io
I don't recognize the description of the change. Are you using draw.io exactly as-is, or did you make code changes? Can you share a simple example that shows this output?

To unsubscribe from this group and stop receiving emails from it, send an email to drawio+unsubscribe@googlegroups.com.

Geoffrey Hill - Tutamantic

unread,
Sep 30, 2018, 9:32:40 AM9/30/18
to David Benson, draw.io

I’m using the draw.io output exactly as-is.

 

The change had to do with how draw.io deals with metadata. Originally the output for the shapes was the same as the connectors. But that changed.

 

Here’s an example.

 

The shape node doesn’t act in the same way as the change to the connector node. The connector node adds an ‘object’ to the connector’s ‘mxcell’. The shape node wraps its original ‘mxcell’ with an ‘object’. Why isn’t the change done consistently?

 

I created a shape originally and it gave me:

<mxCell id="24" value="DB Server" style="shape=cylinder;whiteSpace=wrap;html=1;boundedLbl=1;" vertex="1" parent="1">

<mxGeometry x="240" y="830" width="60" height="80" as="geometry"/>

</mxCell>

 

When I added the name/value pairs, draw.io completely changed the xml. I got this:

<object label="DB Server" Zone="3" Attribute="BLAH.BLAH.BLAH" CRUDE="" id="3">

<mxCell style="shape=cylinder;whiteSpace=wrap;html=1;strokeWidth=1;" vertex="1" parent="1">

<mxGeometry x="240" y="890" width="60" height="80" as="geometry"/>

</mxCell>

</object>

 

-----

Connectors are a bit more simple at least because the draw.io process only adds an object to hold the metadata and keeps the mxcell as the top-level cell.

 

Connectors have the following originally:

<mxCell id="32" value="user-to-WebServer" style="text;html=1;resizable=0;points=[];align=center;verticalAlign=middle;labelBackgroundColor=#ffffff;" vertex="1" connectable="0" parent="26">

<mxGeometry x="-0.0875" relative="1" as="geometry">

<mxPoint as="offset"/>

</mxGeometry>

</mxCell>

 

Which changes to this after I add name/value pairs. The ‘parent’ attribute on the second top-level node (‘mxcell’) below shows me what I believe holds all my information:

<object label="" Zone="" Attribute="" CRUDE="RU" id="9">

<mxCell style="endArrow=classic;html=1;exitX=0.625;exitY=1.017;exitPerimeter=0;entryX=0.5;entryY=0;" edge="1" parent="1" source="2" target="7">

<mxGeometry width="50" height="50" relative="1" as="geometry">

<mxPoint x="580" y="1040" as="sourcePoint"/>

<mxPoint x="260" y="500" as="targetPoint"/>

</mxGeometry>

</mxCell>

</object>

 

 

<mxCell id="16" value="user-to-WebServer" style="text;html=1;resizable=0;points=[];align=center;verticalAlign=middle;labelBackgroundColor=#ffffff;" vertex="1" connectable="0" parent="9">

<mxGeometry x="-0.0661" y="1" relative="1" as="geometry">

<mxPoint as="offset"/>

</mxGeometry>

</mxCell>

To unsubscribe from this group and stop receiving emails from it, send an email to drawio+un...@googlegroups.com.

--

You received this message because you are subscribed to the Google Groups "draw.io" group.

To unsubscribe from this group and stop receiving emails from it, send an email to drawio+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/drawio/92eaaa33-d1fe-4a6b-a06f-a27be2b3c8a9%40googlegroups.com.

Radek S

unread,
Jun 23, 2019, 7:59:18 AM6/23/19
to draw.io
I have got the same issue. I need to decode diagrams to application logic and I was using draw.io. It worked perfectly fine to process xml until some time ago. Now when I revisited old diagram and needed to add new connectors I can see they are saved as <object> instead of <mxcell>. This broke my parser and I have no idea what other changes might have been introduced.

Is it possible to use older version of draw.io, so that I can keep getting old structure when I change my diagram? It is just impossible to use this service unless I have stable schema under the hood.

BR, Radek

David Benson

unread,
Jun 25, 2019, 11:25:46 AM6/25/19
to draw.io
The draw.io file format (mxGraphModel) has never broken backwards compatibilty since it was first created in 2005. When you implement a custom user object, the mxCell/userObject order is inverted so that it's easier to parse the custom user object on the back-end. This isn't new, you just added a user object.
Reply all
Reply to author
Forward
0 new messages