Saving Imagemap Information in XML

To save imagemap information in XML, you call one of the writeImagemapXML methods of the graph. You can pass either an OutputStream or a PrintWriter for storing the XML. To specify which components to include in the information, you pass one of the MAP_ constants. You can also combine the constants, using the OR operator ( | ).

Note that when you use a Thin Graph Bean, the thin graph creates the imagemap for you.

The following example saves information about the graph to an OutputStream. The XML will be stored in the current folder and will include information about the data markers and the legend. This example assumes that you have a graph named myThickGraph.


FileOutputStream infostream = new FileOutputStream("myThinGraph.XML"); myThickGraph.writeImagemapXML(infostream, (MAP_DATA | MAP_LEGEND));

The Document Type Definition (DTD) for the graph is in the JAR file that contains the Graph class. You can look at the DTD by extracting the graph.dtd file from the JAR file.