Minimal GoJS Sample, reading XML data

This is just like the Minimal sample, but this reads XML data from the server.

Here are the contents of the minimal.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<graph>
  <node key="Alpha" color="lightblue" />
  <node key="Beta" color="orange" />
  <node key="Gamma" color="lightgreen" />
  <node key="Delta" color="pink" />
  <link from="Alpha" to="Beta" />
  <link from="Alpha" to="Gamma" />
  <link from="Beta" to="Beta" />
  <link from="Gamma" to="Delta" />
  <link from="Delta" to="Alpha" />
</graph>
  

This sample uses direct binding to XML DOM elements -- the Model's Model.nodeDataArray is actually an XML DOM object, and each Node has data Bindings directly to XML DOM elements.

Such direct binding at the current time only supports read-only models. If you want to read and write XML you need to use regular JavaScript Objects and implement your own persistence from and to XML. Of course even if GoJS supported updating XML DOM directly, this "minimal" sample has no way to update the data on the server.

加入 GoJS 交流群
GoJS 交流群 (769862113)