| 1 |
Saving and loading Gaphor diagrams |
|---|
| 2 |
|
|---|
| 3 |
The idea is to keep the file format as simple and extensible as possible. |
|---|
| 4 |
|
|---|
| 5 |
This is the format as used by Gaphor. |
|---|
| 6 |
|
|---|
| 7 |
Everything interesting is between the `Gaphor' start and end tag. |
|---|
| 8 |
|
|---|
| 9 |
The file is as flat as possible: UML elements (including Diagram) are at |
|---|
| 10 |
toplevel, no nesting. |
|---|
| 11 |
A UML element can have two tags: `Reference' and `Value'. Reference is used to |
|---|
| 12 |
point to other UML elements, Value has a value inside (an integer or astring). |
|---|
| 13 |
|
|---|
| 14 |
Diagram is a special case. Since this element contains a diagram canvas inside, |
|---|
| 15 |
it may become pretty big (with lots of nested elements). |
|---|
| 16 |
This is handled by the load and save function of the Diagram class. |
|---|
| 17 |
All elements inside a canvas have a tag `Item'. |
|---|
| 18 |
|
|---|
| 19 |
<?xml version="1.0" ?> |
|---|
| 20 |
<Gaphor version="1.0" gaphor_version="0.3"> |
|---|
| 21 |
<Package id="1"> |
|---|
| 22 |
<ownedElement> |
|---|
| 23 |
<reflist> |
|---|
| 24 |
<ref refid="2"/> |
|---|
| 25 |
<ref refid="3"/> |
|---|
| 26 |
<ref refid="4"/> |
|---|
| 27 |
</reflist> |
|---|
| 28 |
</ownedElement> |
|---|
| 29 |
</Package> |
|---|
| 30 |
<Diagram id="2"> |
|---|
| 31 |
<namespace> |
|---|
| 32 |
<ref refid="1"/> |
|---|
| 33 |
</namespace> |
|---|
| 34 |
<canvas extents="(9.0, 9.0, 189.0, 247.0)" grid_bg="0xFFFFFFFF" |
|---|
| 35 |
grid_color="0x80ff" grid_int_x="10.0" grid_int_y="10.0" |
|---|
| 36 |
grid_ofs_x="0.0" grid_ofs_y="0.0" snap_to_grid="0" |
|---|
| 37 |
static_extents="0" affine="(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)" |
|---|
| 38 |
id="DCE:xxxx"> |
|---|
| 39 |
<item affine="(1.0, 0.0, 0.0, 1.0, 150.0, 50.0)" cid="0x8293e74" |
|---|
| 40 |
height="78.0" subject="3" type="ActorItem" width="38.0"/> |
|---|
| 41 |
<item affine="(1.0, 0.0, 0.0, 1.0, 10.0, 10.0)" cid="0x82e7d74" |
|---|
| 42 |
height="26.0" subject="5" type="CommentItem" width="100.0"/> |
|---|
| 43 |
</canvas> |
|---|
| 44 |
</Diagram> |
|---|
| 45 |
<Actor id="3"> |
|---|
| 46 |
<name> |
|---|
| 47 |
<val><![CDATA[Actor]]></val> |
|---|
| 48 |
</name> |
|---|
| 49 |
<namespace> |
|---|
| 50 |
<ref refid="1"/> |
|---|
| 51 |
</namespace |
|---|
| 52 |
</Actor> |
|---|
| 53 |
<UseCase id="4"> |
|---|
| 54 |
<namespace> |
|---|
| 55 |
<ref refid="1"/> |
|---|
| 56 |
</namespace> |
|---|
| 57 |
</UseCase> |
|---|
| 58 |
<Comment id="5"/> |
|---|
| 59 |
</Gaphor> |
|---|