This package provides a way to generate or store graphs in a simplified XML format. All Object arguments are assumed to be Strings and this is enforced. All
add()
methods with a String key parameter use this as an 'id=' attribute on the resulting XML tag generated. These tags may also have a 'type='
and 'name=' attribute but these are completely optional. The type is set via the Renderable setType()
method, which is implemented to translate
to the 'type=' attribute in all cases. The 'name=' attribute is set when the Renderable
is created from the GraphEngineXML
. The
'pKey' Object argument, if not null or blank, becomes the 'name=' attribute. This should, of course, be a String; if not, it will be converted during rendering.
The 'id=' attribute, required for everything but GraphPaper
, takes its value from the 'pKey' String argument used to add components to the
GraphPaper
and it may be neither blank nor null.
External programs used to generate image (or print!) graphs can benefit from the XML package. This assumes, of course, that they can consume plain text (Strings) and generate output from that. Since this implementation deals exclusively with String data, and since it is XML markup, it can be transformed via XSLT into whatever format the external program needs.
If XSLT is not sufficient, the XML generated can be parsed into a DOM tree and manipulated directly. There is no DTD or Schema, but the markup is simple and
straightforward. In fact, the MathTools scripting framework can parse and manipulate the DOM tree easily: the MTXPro parseDOM()
method and
associated machinery provide exactly that capability.
Even if XML is not the ultimate solution, the markup generated can be used to persist or store graph data. All required graphing.*
interfaces
and methods are defined and all of them store any data added in a consistent, logical, and XML-proper way.