Package eu.kartoffelquadrat.svgpatcher
Class SvgPatcher
java.lang.Object
eu.kartoffelquadrat.svgpatcher.SvgPatcher
Code based on the example by mkyong:
https://mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SvgPatcher
public SvgPatcher()Default constructor.
-
-
Method Details
-
main
public static void main(String[] args) throws IOException, SAXException, ParserConfigurationException, TransformerException Makes to changes to a provided SVG document (generated by omnigraffle). First: boosts the svg dimensions so the svg is correctly rendered and not too tiny. Second: searches for IDs that Omnigraffle places as title attributes and adapts these id values as actual svg ids, so browser javascript frameworks can actually find them and conveniently modify the DOM.- Parameters:
args- first argument in input file to parse, second argument is where to store the target file. Last argument is link to a file with custom css definitions (pass empty file if not needed).- Throws:
IOException- in case provided file can not be readSAXException- in case provided file can not be interpreted as svg / does not comply to DTDParserConfigurationException- in case the parser arguments cannot be appliedTransformerException- in case the modified svg cannot be persisted to disk
-