可以为图形元素定义简单的属性来扩展Graph。属性只能使用xml中的简单类型,如string, numerical等。首先看一个例子:
<meta content="text/html; charset=utf-8" http-equiv="CONTENT-TYPE"> <meta content="StarSuite 8 (Linux)" name="GENERATOR"> <meta content="*" name="AUTHOR"> <meta content="20071029;11490000" name="CREATED"> <meta content="Seaman Wang" name="CHANGEDBY"> <meta content="20080123;13032000" name="CHANGED"> <style type="text/css"> <!-- @page { size: 21cm 29.7cm; margin: 2cm } PRE.western { font-family: "Cumberland", "Courier New", monospace } PRE.cjk { font-family: "方正宋体", monospace } PRE.ctl { font-family: "方正宋体", monospace } P { margin-bottom: 0.21cm } H3 { margin-bottom: 0.21cm } H3.western { font-family: "Albany", "Arial", sans-serif } H3.cjk { font-family: "方正黑体"; font-style: normal } H3.ctl { font-family: "Lucidasans" } --> </style>
可以看出,要增加扩展属性,需要在GraphML中增加属性定义和属性值。
属性定义部分声明了属性的标识(id),适用范围,名称,类型和默认值(可选)。如:
这样,GraphML的概念包括了: