SVG Pretty-Printer


Batik comes with a command-line tool you can use to pretty-print SVG files. It can help the readability of the file substantially and can be a help if you’re trying to debug a broken SVG file. To run the pretty-printer, execute the following command:

java –jar batik-svgpp.jar [options] [input file] [output file]

This command assumes that batik-svgpp.jar is present in the current directory, but you can supply the full path to the jar file and things will work fine. If you omit the output filename, then the pretty-printed output will appear on the standard output instead of being written to a file.

The pretty-printer is controlled by a number of option flags:

  • -newline <cr | cr-lf | lf>—Specifies the character to use for line endings. The default is lf, the UNIX newline character. The DOS/Windows newline character is cr-lf, and the Macintosh uses cr.

  • -tab-width <number>—Sets the number of spaces in a tab. Defaults to 4.

  • -doc-width <number>—Sets the number of columns in the document. Defaults to 80.

  • -no-format—Doesn’t perform any indentation. You can still change newlines or change the DOCTYPE.

  • -xml-decl <string>—Supplies a string for the XML declaration.

  • -doctype <change | remove>—Either removes or changes the DOCTYPE of the document. If change is selected, uses one or both of -public-id and -system-id to supply new values for the DOCTYPE.

  • -public-id <string>—Supplies a new string for the document’s public identifier. Must be used with -doctype change.

  • -system-id <string>—Supplies a new string for the document’s system identifier. Must be used with -doctype change.




Professional XML Development with Apache Tools. Xerces, Xalan, FOP, Cocoon, Axis, Xindice
Professional XML Development with Apache Tools: Xerces, Xalan, FOP, Cocoon, Axis, Xindice (Wrox Professional Guides)
ISBN: 0764543555
EAN: 2147483647
Year: 2003
Pages: 95

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net