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.

...

--trace

...

-t

...

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

...

--config

...

-c

...

-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

...

--infoset‑type

...

-I

...

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

...

--output

...

-o

...

<output>

...

--parser

...

-P

...

<parser>

...

--path

...

-p

...

<path>

...

--root

...

-r

...

[{<namespace>}]<root>

...

--schema

...

-s

...

<schema>

...

-T

...

<tunable>=<value>

...

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

...

--validate

...

-V

...

[mode]

...

[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.

...

--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

...

--config

...

-c

...

-D

...

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

...

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

...

--infoset‑type

...

-I

...

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

...

‑‑output

...

-o

...

<output>

...

‑‑parser

...

-P

...

<parser>

...

‑‑path

...

-p

...

<path>

...

‑‑root

...

-r

...

[{<namespace>}]<root>

...

‑‑schema

...

-s

...

<schema>

...

-T

...

<tunable>=<value>

...

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

...

‑‑validate

...

-V

...

[mode]

...

[infile]

...

‑‑help

...

Example

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

Save Parser Subcommand

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

...

‑‑config

...

-c

...

-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

...

‑‑path

...

-p

...

<path>

...

‑‑root

...

-r

...

[{<namespace>}]<root>

...

‑‑schema

...

-s

...

<schema>

...

-T

...

<tunable>=<value>

...

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

...

‑‑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.

...

 

...

 

...

[outfile]

...

‑‑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...]

...

‑‑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)
                     [-u] [-V[mode]] [-N <number>] [-t <threads>]
                     [-D[{namespace}]<variable>=<value>] [-I <infoset_type>] <infile>

Options

...

‑‑config

...

-c

...

<file>

...

-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

...

‑‑infoset-type

...

-I

...

<infoset_type>

...

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.

...

‑‑number

...

-N

...

<number>

...

‑‑parser

...

-P

...

<parser>

...

‑‑path

...

-p

...

<path>

...

‑‑root

...

-r

...

[{<namespace>}]<root>

...

‑‑schema

...

-s

...

<schema>

...

‑‑threads

...

-t

...

<threads>

...

-T

...

<tunable>=<value>

...

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

...

‑‑unparse

...

-u

...

 

...

--validate

...

-V

...

[mode]

...

[infile]

...

Input file or directory containing files to process

...

--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/