Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

CLI Usage

daffodil [GLOBAL_OPTIONS] <subcommand> [SUBCOMMAND_OPTIONS]

Environment Variables

Setting environment variables may be necessary to allow for importing/includes to work and when running tdml files.

DAFFODIL_CLASSPATH

The Daffodil implementation will look on the classpath for includes and imports, and some tdml files. To define additional directories where Daffodil should look for files, set the DAFFODIL_CLASSPATH environment variable, for example:

Code Block
languagebash
$ export DAFFODIL_CLASSPATH="/path/to/imports/:/path/to/includes/"

In addition to defining directories to search for imports and includes, you can add a CatalogManager.properties file to the DAFFODIL_CLASSPATH to direct Daffodil to a relative path location of a user XML Catalog.

DAFFODIL_JAVA_OPTS

If you need to specify java options specific to Daffodil, you can set the DAFFODIL_JAVA_OPTS environment variable. If not specified, the JAVA_OPTS environment variable will be used. If that is not specified, reasonable defaults for Daffodil will be used.

Global Options

...

--debug

...

-d

...

Enable the interactive debugger. See the Interactive Debugger documentation for more information.

The optional file argument is a list of debugger commands that are provided to the debugger as if it was type by the user.

This option cannot be used with the --trace option.

...

Enable a trace mode. This mode prints out helpful information during every stage of parsing.

This option cannot be used with the --debug option.

...

--verbose

...

-v

...

Enable verbose mode and increment verbosity level. Each additional v provides a new level of information.

...

--version

...

--help

...

Parse Subcommand

Parse a file, using either a DFDL schema or a saved parser.

Usage

daffodil parse (-s <schema> [-r [{<namespace>}]<root>] [-p <path>] | -P <parser>) [-D[{namespace}]<variable>=<value>...] [-T<tunable>=<value>] [-o <output>] [-V [mode]] [-c <file>] [-I <infoset_type>] [infile]

Options

 

...

--schema

...

-s

...

<schema>

...

--root

...

-r

...

[{<namespace>}]<root>

...

--path

...

-p

...

<path>

...

--parser

...

-P

...

<parser>

...

-D

...

[{<namespace>}]<variable>=<value>

...

Variables to be used when parsing. The variable can be prefixed with {namespace} to define which namespace the variable belongs in, for example:

-D{http://example.com}var1=val

...

-T

...

<tunable>=<value>

...

Modify Daffodil configuration options to change parsing behavior. See Configuration File#Tunable Parameters for the list of tunable parameters.

...

--output

...

-o

...

<output>

...

--validate

...

-V

...

[mode]

...

Infoset type to output. Must be one of 'xml', 'scala-xml', 'json', 'jdom', or 'null'. Defaults to 'xml' if not provided.

...

[infile]

...

Input file to parse. If not specified, or is a value of -, reads from standard in. If supplied, this must be the last option on the command line.

...

--version

...

--help

...

Example

daffodil parse -s csv.dfdl.xsd test_file.csv

Unparse Subcommand

Unparse an infoset file, using either a DFDL schema or a saved parser.

Info

The unparse subcommand was implemented as of version 1.1.0.

Usage

daffodil unparse (-s <schema> [-r [{<namespace>}]<root>] [-p <path>] | -P <parser>) [-D[{<namespace>}]<variable>=<value>...] [-T<tunable>=<value>] [-o <output>] [-V [mode]] [-c <file>] [-I <infoset_type>] [infile]

Options

...

--schema

...

-s

...

<schema>

...

--root

...

-r

...

[{<namespace>}]<root>

...

--path

...

-p

...

<path>

...

--parser

...

-P

...

<parser>

...

-D

...

[{<namespace>}]<variable>=<value>

...

-D{http://example.com}var1=val

...

-T

...

<tunable>=<value>

...

Modify Daffodil configuration options to change parsing behavior. See  Configuration File#Tunable Parameters for the list of tunable parameters.

...

--output

...

-o

...

<output>

...

--validate

...

-V

...

[mode]

...

Infoset type to unparse. Must be one of 'xml', 'scala-xml', 'json', or 'jdom'. Defaults to 'xml' if not provided.

...

[infile]

...

--version

...

--help

...

Example

daffodil unparse -s csv.dfdl.xsd test_file.infoset

Save Parser Subcommand

Create a save a parser that can be reused for parsing and unparsing.

Usage

daffodil save-parser -s <schema> [-r [{namespace}]<root>] [-p <path>] [-o <output>] [outfile]

Options

...

--schema

...

-s

...

<schema>

...

--root

...

-r

...

[{<namespace>}]<root>

...

--path

...

-p

...

<path>

...

--validate

...

-V

...

[mode]

...

The validation mode. 'limited' or 'off'. Mode is required. If --validate is not present, defaults to 'off'. Mode cannot be set to 'on' as possible in other commands.

...

-D

...

[{<namespace>}]<variable>=<value>

...

Variables to be used when parsing. The variable can be prefixed with {namespace} to define which namespace the variable belongs in, for example:

-D{http://example.com}var1=val

...

 

...

 

...

[outfile]

...

--version

...

--help

...

Example

daffodil save-parser -s csv.dfdl.xsd csv_parser.xml

Test Subcommand

List or execute tests in a TDML file.

Usage

daffodil test [-l] [-r] [-i] <tdmlfile> [testname...]

Options

 

...

--info

...

-i

...

 

...

Increment test result information output level, one level for each occurrence of -i.

...

--list

...

-l

...

 

...

--regex

...

-r

...

 

...

 

...

 

...

<tdmlfile>

...

 

...

 

...

[testname...]

...

--version

...

--help

...

Example

daffodil test csv.tdml

Performance Subcommand

Run a performance test (parse or unparse), using either a DFDL schema or a saved parser

Info

The unparse option of the performance subcommand was implemented as of version 1.1.0.

Usage

daffodil performance (-s <schema> [-r [{namespace}]<root>] [-p <path>] |  -P <parser) [--unparse] [--validate [mode]] [-N <number of files to process] [-t <threadcount>] [-D[{namespace}]<variable>=<value>] [-I <infoset_type>] <infile>

Options

 

...

--schema

...

-s

...

<schema>

...

--root

...

-r

...

[{<namespace>}]<root>

...

--path

...

-p

...

<path>

...

--parser

...

-P

...

<parser>

...

-D

...

[{<namespace>}]<variable>=<value>

...

Variables to be used when parsing. The variable can be prefixed with {namespace} to define which namespace the variable belongs in, for example:

-D{http://example.com}var1=val

...

-T

...

<tunable>=<value>

...

Modify Daffodil configuration options to change processing behavior. See Configuration File#Tunable Parameters for the list of tunable parameters.

...

--unparse

...

 

...

 

...

--validate

...

-V

...

[mode]

...

Infoset type to parse/unparse. Must be one of 'xml', 'scala-xml', 'json', 'jdom', or 'null'. Defaults to 'xml' if not provided. Note that 'null' is not valid if the --unparse option is provided.

...

[infile]

...

Input file or directory containing files to process

...

--version

...

--help

...

Example

daffodil performance -s csv.dfdl.xsd -N 1000 -t 5 test_file.csv

...

this page has moved to https://daffodil.apache.org/cli/