mxGraph中的xml格式问题 本帖最后由 edwin1215 于 2013-02-04 11:26:59 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //Xml文件这样来读。// Load cells and layouts the graph graph.getModel().beginUpdate(); try { // Loads the custom file format (TXT file) //parse(graph, 'fileio.txt'); // Loads the mxGraph file format (XML file) read(graph, 'fileio.xml'); // Gets the default parent for inserting new cells. This // is normally the first child of the root (ie. layer 0). var parent = graph.getDefaultParent(); // Executes the layout layout.execute(parent); } finally { // Updates the display graph.getModel().endUpdate(); }//Xml文件格式<mxGraphModel> <root> <mxCell id="0"/> <mxCell id="1" parent="0"/> <mxCell id="2" customId="2" value="<img src="editors/images/overlays/user3.png"><br><b>Last, First</b><br>Status<br>Info" vertex="1" parent="1"> <mxGeometry x="0" y="0" width="80" height="70" as="geometry"/> </mxCell> <mxCell id="3" customId="3" value="<img src="editors/images/overlays/error.png"><br><b>Errorcode</b><br>Status<br>Info" vertex="1" parent="1"> <mxGeometry x="0" y="0" width="80" height="70" as="geometry"/> </mxCell> <mxCell id="4" customId="4" value="<img src="editors/images/overlays/flash.png"><br><b>Warning</b><br>Status<br>Info" vertex="1" parent="1"> <mxGeometry x="0" y="0" width="120" height="70" as="geometry"/> </mxCell> <mxCell id="5" customId="5" value="<img src="editors/images/overlays/users3.png"><br><b>Groupname</b><br>Status<br>Info" vertex="1" parent="1"> <mxGeometry x="0" y="0" width="80" height="70" as="geometry"/> </mxCell> <mxCell id="6" customId="6" value="<img src="editors/images/overlays/workplace.png"><br><b>Workplace</b><br>Status<br>Info" vertex="1" parent="1"> <mxGeometry x="0" y="0" width="80" height="70" as="geometry"/> </mxCell> <mxCell id="7" customId="6" value="<img src="editors/images/overlays/information.png"><br><b>Information</b><br>Status<br>Info" vertex="1" parent="1"> <mxGeometry x="0" y="0" width="80" height="70" as="geometry"/> </mxCell> <mxCell id="8" customId="7" value="<img src="editors/images/overlays/printer.png"><br><b>Printername</b><br>Status<br>Info" vertex="1" parent="1"> <mxGeometry x="0" y="0" width="120" height="70" as="geometry"/> </mxCell> <mxCell id="edge-1" customId="edge-1" value="<img src="editors/images/overlays/lightbulb_on.png"> Hint" edge="1" parent="1" source="2" target="3"> <mxGeometry relative="1" as="geometry"/> </mxCell> <mxCell id="edge-2" customId="edge-2" value="<img src="editors/images/overlays/help.png"> News" edge="1" parent="1" source="2" target="4"> <mxGeometry relative="1" as="geometry"/> </mxCell> <mxCell id="edge-3" customId="edge-3" value="<img src="editors/images/overlays/information.png"> Member" edge="1" parent="1" source="2" target="5"> <mxGeometry relative="1" as="geometry"/> </mxCell> <mxCell id="edge-4" customId="edge-4" value="<img src="editors/images/overlays/pencil.png"> Details" edge="1" parent="1" source="6" target="7"> <mxGeometry relative="1" as="geometry"/> </mxCell> <mxCell id="edge-5" customId="edge-5" value="<img src="editors/images/overlays/check.png"> Access" edge="1" parent="1" source="6" target="8"> <mxGeometry relative="1" as="geometry"/> </mxCell> <mxCell id="edge-6" customId="edge-6" value="<img src="editors/images/overlays/forbidden.png"> Access" edge="1" parent="1" source="5" target="6"> <mxGeometry relative="1" as="geometry"/> </mxCell> <mxCell id="edge-7" customId="edge-7" value="<img src="editors/images/overlays/lightbulb_on.png"> 2-Way" style="2way" edge="1" parent="1" source="2" target="6"> <mxGeometry relative="1" as="geometry"/> </mxCell> </root></mxGraphModel> html和xhtml之间的区别为什么在浏览器中没有作用 急!ActiveXObject 未定义的问题,求大侠解决。 jquery 表格弄出来的东西塞进数组? onkeyup 与onblur冲突 如何从表单取值? 『研究』如何实现鼠标点击链接时出现链接介绍,顺便送一个BT下载电影的好网址! 如何把文字中的 去掉,如 中国 我的可怜的菜单,大家来帮忙啊! 字符串替换 ueditor怎么修改成上传图片分类 javascript中怎么换行和空格? 这个问题有点头疼啦。$('#news_ul').html(strhtml)不起作用
// Load cells and layouts the graph
graph.getModel().beginUpdate();
try
{
// Loads the custom file format (TXT file)
//parse(graph, 'fileio.txt');
// Loads the mxGraph file format (XML file)
read(graph, 'fileio.xml');
// Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0).
var parent = graph.getDefaultParent(); // Executes the layout
layout.execute(parent);
}
finally
{
// Updates the display
graph.getModel().endUpdate();
}//Xml文件格式
<mxGraphModel>
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="2" customId="2" value="<img src="editors/images/overlays/user3.png"><br><b>Last, First</b><br>Status<br>Info" vertex="1" parent="1">
<mxGeometry x="0" y="0" width="80" height="70" as="geometry"/>
</mxCell>
<mxCell id="3" customId="3" value="<img src="editors/images/overlays/error.png"><br><b>Errorcode</b><br>Status<br>Info" vertex="1" parent="1">
<mxGeometry x="0" y="0" width="80" height="70" as="geometry"/>
</mxCell>
<mxCell id="4" customId="4" value="<img src="editors/images/overlays/flash.png"><br><b>Warning</b><br>Status<br>Info" vertex="1" parent="1">
<mxGeometry x="0" y="0" width="120" height="70" as="geometry"/>
</mxCell>
<mxCell id="5" customId="5" value="<img src="editors/images/overlays/users3.png"><br><b>Groupname</b><br>Status<br>Info" vertex="1" parent="1">
<mxGeometry x="0" y="0" width="80" height="70" as="geometry"/>
</mxCell>
<mxCell id="6" customId="6" value="<img src="editors/images/overlays/workplace.png"><br><b>Workplace</b><br>Status<br>Info" vertex="1" parent="1">
<mxGeometry x="0" y="0" width="80" height="70" as="geometry"/>
</mxCell>
<mxCell id="7" customId="6" value="<img src="editors/images/overlays/information.png"><br><b>Information</b><br>Status<br>Info" vertex="1" parent="1">
<mxGeometry x="0" y="0" width="80" height="70" as="geometry"/>
</mxCell>
<mxCell id="8" customId="7" value="<img src="editors/images/overlays/printer.png"><br><b>Printername</b><br>Status<br>Info" vertex="1" parent="1">
<mxGeometry x="0" y="0" width="120" height="70" as="geometry"/>
</mxCell>
<mxCell id="edge-1" customId="edge-1" value="<img src="editors/images/overlays/lightbulb_on.png"> Hint" edge="1" parent="1" source="2" target="3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="edge-2" customId="edge-2" value="<img src="editors/images/overlays/help.png"> News" edge="1" parent="1" source="2" target="4">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="edge-3" customId="edge-3" value="<img src="editors/images/overlays/information.png"> Member" edge="1" parent="1" source="2" target="5">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="edge-4" customId="edge-4" value="<img src="editors/images/overlays/pencil.png"> Details" edge="1" parent="1" source="6" target="7">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="edge-5" customId="edge-5" value="<img src="editors/images/overlays/check.png"> Access" edge="1" parent="1" source="6" target="8">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="edge-6" customId="edge-6" value="<img src="editors/images/overlays/forbidden.png"> Access" edge="1" parent="1" source="5" target="6">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="edge-7" customId="edge-7" value="<img src="editors/images/overlays/lightbulb_on.png"> 2-Way" style="2way" edge="1" parent="1" source="2" target="6">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>