Working with the GraphML File Format

There are various possibilities to read and write GraphML data in yFiles FLEX:

API Excerpt 4.1. GraphCanvasComponent support for GraphML import and export

// Reading a graph into the GraphCanvasComponent
loadGraphFromURL(URL:String, ioHandler:IOHandler = null, 
                 theGraph:IGraph = null):void
loadGraphFromXML(xml:XML, ioHandler:GraphMLIOHandler = null, 
                 theGraph:IGraph = null):void

// Writing a graph to XML
writeGraph( ioHandler:GraphMLIOHandler=null ):XML

More control over the serialization or deserialization process is provided by class GraphMLIOHandler. The I/O handler can read and write graphs to/from GraphML through the methods listed in API Excerpt 4.2, “GraphMLIOHandler read and write methods”.

Most applications will use a preconfigured DefaultGraphMLIOHandler, JavaCompatGraphMLIOHandler, or DotnetCompatGraphMLIOHandler subclass of GraphMLIOHandler. A "plain" GraphMLIOHandler instance registers no additional IInputHandlers, IOutputHandlers, ISerializers, IDeserializers or IRealizerSerializers. Hence, only structural data will be read and written if the handler is not configured before reading or writing.

Note that the read and readURL methods require an existing IGraph instance which will be populated by the GraphMLIOHandler.

API Excerpt 4.2. GraphMLIOHandler read and write methods

// Populating the given IGraph.
read(graph:IGraph, xml:XML):void
readURL(graph:IGraph, URL:String):void
 
// Writing the given IGraph.
write(graph:IGraph):XML