I want to perform an operation, which is the inverse of what I do when generating the xmlString in mxGraph ().
mxGraph graph = new mxGraph();
Object parent = graph.GetDefaultParent();
graph.Model.BeginUpdate();
try
{
Object v1 = graph.InsertVertex(parent, null, "Hello,", 20, 20, 80, 30);
Object v2 = graph.InsertVertex(parent, null, "World!", 200, 150, 80, 30);
Object e1 = graph.InsertEdge(parent, null, "Edge", v1, v2);
}
finally
{
graph.Model.EndUpdate();
}
mxCodec codec = new mxCodec();
Xml = mxUtils.GetXml(codec.Encode(graph.Model));
var xmlString = mxUtils.GetXml(xml);
I am trying to perform the reverse operation.
XmlDocument doc = mxUtils.ParseXml(xmlString);
mxGraph graphNew = new mxGraph();
var decoder = new mxCodec(doc);
decoder.Decode(doc, graphNew.Model);
Object parentNew = graphNew.GetDefaultParent();
But the parentNew object has no children.
source
share