Merge Filters
Merge is necessarily given data to work with — via its -data
option.
However, that data as originally provided may not be completely suitable for Merge to use with the given form. In fact, it might not even be in XML format.
Merge has the concept of data filters. You can specify a data filter, or a chain of them, to massage the original data stream into something that is more suited to later processing.
The Merge -filter
command line option is used to indicate the need to convert incoming data to a Merge-compatible XML data stream. The -filter
option specifies a Filter Program — either an executable program or a JavaScript script. DocOrigin includes some standard filters, and is architected so that you may provide additional filters. The filter program is passed the input data file and must return a correctly formatted XML data file. This returned XML file is what is then processed by Merge.
Other sections describe some pre-built filter programs that are part of the DocOrigin installation and later describe how to write and test a JavaScript filter. You can write your own executable filters, if you like, too.
Filter options
When using the -filter option, three other options may also be specified on the Merge command line:
-filterParm
— allows additional options to be passed to the filter program.
With the advent of multiple filters in one Merge run, these parameters get passed to each filter. No problem, as filters ignore parameters they don't understand. This option is deprecated in favour of providing the options as defined in -filter.
-filterOutput
— will create a copy of the output XML data in a location of your choosing. That is if you want to refer to it later or are debugging. With the advent of muliple filters in one Merge run, by end of job, it will be the last filter's output that will be in this -filterOutput specified location.-trace tracefile
— writes additional debug information to the file.
All pre-built converters use the standard DocOrigin command line syntax — see Command Line Processing.
Command options are typically stored in a parameter file which is passed to Merge.
All standard DocOrigin command options also are available — see Common Command Line Options.
See also
-filter
Standalone usage
Note that the filter programs can also be run standalone, independent of Merge. This can be useful for testing or in Job Processing scripts where perhaps Merge is not even involved or the structure of your script leads you to want to do this filtering independently of Merge.
When used in a standalone fashion the filter programs must be passed the -in
and -out
parameters explicitly. In a Merge filter context those parameters are supplied automatically.