Where to Find Up-to-date yFiles Information

This page is from the outdated yFiles for Java 2.13 documentation. You can find the most up-to-date documentation for all yFiles products on the yFiles documentation overview page.

Please see the following links for more information about the yFiles product family of diagramming programming libraries and corresponding yFiles products for modern web apps, for cross-platform Java(FX) applications, and for applications for the Microsoft .NET environment.

More about the yFiles product family Close X

XGML

XGML is an XML-ish variant of the GML file format where sections and attributes as listed in the various tables of section GML File Format are wrapped in <section> and <attribute> tags, respectively.

What it Looks Like

Example 9.20, “XGML representation” shows the beginning of a file having "GML-over-XML" encoding.

Example 9.20. XGML representation

<section name="xgml">
  <attribute key="Creator" type="String">yFiles</attribute>
  <attribute key="Version" type="String">2.3.1</attribute>
  <section name="graph">
    <attribute key="hierarchic" type="int">1</attribute>
    <attribute key="directed" type="int">1</attribute>
    <section name="node">
      <attribute key="id" type="int">0</attribute>
      <section name="graphics">
        <attribute key="x" type="double">200.0</attribute>
        <attribute key="y" type="double">0.0</attribute>
      </section>
      <section name="LabelGraphics">
        <attribute key="text" type="String">January</attribute>
      </section>
    </section>
    ...
    
</section>

Common Usage

An XGML file is written using class XGMLIOHandler which is a descendant of GMLIOHandler and is used similarly to its superclass. The code fragment in Example 9.21, “Instantiating an XGMLIOHandler” shows how to instantiate an XGMLIOHandler and use it to write a graph to file.

Note

XGMLIOHandler can be used with the Java 2 Runtime Environment beginning with version 1.4.

Example 9.21. Instantiating an XGMLIOHandler

// Instantiate an XGML I/O handler and write the graph to file. 
IOHandler ioh = new XGMLIOHandler();
writeGraphToFile(graph, ioh, "MyXGML.xgml");