XML Generator

The dsClient jar can be run without a display to export workspaces to XML files or to upgrade XML files that use the legacy subscriber database structure. Files can be processed individually or in a batch process. In this mode resources are extracted from the jar as needed and the schema to be used is specified in the launch command. There is no installation process and the jar can be run on a client platform or on a server as long as a compatible JRE is provided.

 

Requirements

 

dsClient v4.0.20170214 or later

Oracle Java 8 desktop JRE

dsTest schema files

 

Launching the Jar

Syntax (all options are required):

java -jar dsClient.jar -mode xml -schema <path to dsTest schema> -in [<path to file> | <file list>.txt] -out <destination directory path>

java

If running on a client platform no qualification should be necessary as long as Java has been installed. If running on a server, download and unpack a desktop JRE that is compatible with the OS and include the path to the bin directory.

-schema

absolute path to the main schema file, including the file name. When running on a dsTest server the path is /usr/local/devsol/config/dsTest.xsd.

-in

Path to the workspace or XML file, including the file name, if processing a single file. If processing multiple files, the path and file name of a text file that lists the files to be processed. In both cases the path can be absolute or relative to the location of the jar (run directory). If using a text file it must reside in the same, or parent, directory of the input files. The paths within the text file can also be absolute or relative to the run directory. When processing a batch of files they must all be of the same type – either .dsx or .xml. NOTE: do not include snippet files in the file list, only workspace files.

-out

Destination path for the resulting XML files. This path can also be absolute or relative to the location of the jar.

Progress Reporting and Exit Codes

As each file is processed a message is printed to the console – 'Processing file <file name>'. There may be a delay before the first message appears depending on the number of files to be processed as the application validates the location of all input files and creates all of the output files.

When the application exits it will print the exit code to the console:

0: Success – all output files should have been written.

2: An IO error was encountered. The application was unable to locate, read, or parse an input file, was unable to locate the main schema file, was unable to read resource files from the jar, or was unable to create or write to the output directory. When this type of error is encountered the application will immediately exit.

3: Schema error – the application was unable to construct the dsTest schema parser or the workspace file parser. Either error will cause an immediate exit.

4: Invalid workspace – one or more input files uses deprecated items or contains validation errors. If validation errors are present XML will not be generated and a SEVERE message is written to the client log file. Use of deprecated items will not prevent XML generation but will cause a WARNING message to be written to the client log file.

5: Fatal error – an error was thrown by the application. This will normally generate a SEVERE message in the client log file and cause the application to exit.

Automating the Process

This example assumes that the application is run on a dsTest server using the following directory structure:

xml_conversion/

dsClient.jar

jre/

[extraction]

input/

input_files.txt

[files to be processed, files may be in sub-directories]

output/

The list of files can be generated using the find command while in the run directory:

>find input/ -type f –name “*.dsx” > input/input_files.txt

NOTE: If you use snippets, either manually construct the file list or use a naming convention to segregate workspace files from snippet files.

Launch command (from run directory):

>jre/bin/java -jar dsClient.jar -mode xml -schema /usr/local/devsol/config/dsTest.xsd -in input/input_files.txt -out output