x2svg is a collection of ant tasks that can be used to convert various heirarchical tree structural forms into a visual representation. e.g. convert a DTD into an SVG. Various input and output formats are supported by these tasks.
The current implementation supports a main 'x2svg' task (that supplies global configuration settings) with a parser sub-task, that is responsible for actually parsing and converting files ot the requested output format(s).
The parser sub-task can either auto-detect (based on file extension) the type of file being parsed, or force the type by setting a task parameter.
The parameters on the x2svg task are global properties that are applied to all sub-tasks that are exectued under this main task.
Attribute | Description | Required |
---|---|---|
debugEnabled | If set to true, x2svg will output verbose debugging information. This is a global setting that applies to all sub-tasks. | No, default is false |
propertiesLocation | If specified, x2svg will try to load the properties configuration from the given location. If not specified, the task will attempt to load x2svg.properties from the system classpath. If this fails, then default values are used. | No |
Zero or one output
elements are allowed within an x2svg
task.
The nested output
element specifies the output formats that
should be produced. This element is optional - if no output formats
are specified, then only SVG will be outputted. If, however, this element
is specified, then one or more format elements must be specified. Also, SVG will
NOT be automatically outputted if an output element is present, it must be
explicitly specified.
One or more format
elements are allowed within an output
element.
The output sub-task allos for one or more output formats to be specified. ~For each specified format tag inside an output tag, an appropriate renderer will be used to produce output in the requested format. If the format specified is invalid, it is ignored.
Attribute | Description | Required |
---|---|---|
type |
Specify the format that the parsed output tree will be rendered as. If an unknown format is specified, it will be ignored. The following format output options are supported:
|
Yes |
One or more parser
elements are allowed within an x2svg
element.
The nested parser
element specifies a set of files or folders
(as one or more filesets) that should be processed to convert their native
form into a graphical representation.
Attribute | Description | Required |
---|---|---|
mode | Specify the type of file that is being parsed by this sub-task. Specifying auto will force the parser to evaluate each file in turn, and attempt to best-guess the format for parsing. Any files encountered whose format cannot be determined will be logged, and skipped. | Yes |
Zero or one comment
elements are allowed within an parser
element.
The parser
sub-task supports zero or one nested <comment> elements that specify the
comment to be annotated to each parsed output.
Attribute | Description | Required |
---|---|---|
message | Specify the message or comment that should be added to each generated SVG. | No |
One or more fileset
elements are allowed within an parser
element.
The parser
sub-task supports one ot more nested <fileset> elements that specify the files that are to
be included in this parse/conversion process.
parser
sub-task exampleSee the doc/examples/ directory of the distribution for a sample build file.
<x2svg debug="true" propertiesLocation="x2svg.properties"> <output> <!-- Output each (valid) parsed input as a PDF, and PNG. --> <format type="pdf" /> <format type="png" /> </output> <parser mode="auto"> <!-- A parser sub-task that will attempt to auto-detect which parser to use --> <!-- based on the extension of the encountered file. --> <fileset dir="${build}/classes" excludes="**/Test.class" /> </parser> <parser mode="dtd"> <!-- A parser sub-task that will only attempt to parse DTDs --> <!-- the includes is not neccessary, but helps clarity. --> <comment message="These examples demonstrtes parsing DTD files." /> <fileset dir="${build}/resources/dtd" includes="**/*.dtd" /> </parser> </x2svg>
One or more convertor
elements are allowed within an x2svg
element.
The nested convertor
element specifies a set of files or folders
(as one or more filesets) that should be converted from SVG into different
specified graphical representations.
One or more fileset
elements are allowed within an convertor
element.
The convertor
sub-task supports one ot more nested <fileset> elements that specify the SVG files
that are to be included in this conversion process.
convertor
sub-task exampleSee the doc/examples/ directory of the distribution for a sample build file.
<x2svg debug="true"> <output> <!-- Output JPG converted files. --> <format type="jpg" /> </output> <convertor> <!-- A convertor sub-task that will attempt to convert SVG files --> <!-- to the output formats specified above. --> <fileset dir="${build}/images" includes="**/*.svg" /> </convertor> </x2svg>