Custom header in SVG XML?


We are saving a graph with serialized java objects as SVG XML. We would like to save version information as clear text in XML, preferably at the top of the XML file. How do we do that?


You can add attributes to the document within any of the SVGWriteObject() methods of your JGoObject subclasses by calling getDocumentElement() and adding your attributes:
public void SVGWriteObject(DomDoc svgDoc, DomElement jGoElementGroup)
com.nwoods.jgo.svg.DefaultDocument svgDomDoc = (com.nwoods.jgo.svg.DefaultDocument)svgDoc;
DomElement root = svgDomDoc.getDocumentElement();
root.setAttribute(“MyVersion”, “1.0.0”);

Works like a charm. Thanks a lot for that!