Skip to end of metadata
Go to start of metadata

There are many examples of DFDL Schemas and data that can be run using Daffodil.  They can be found at:

Examples showing how to use the Daffodil API so as to embed Daffodil into an application are at:


Following are commands that can be run from the root directory of the of the daffodil tree. That is, if you download and extract a daffodil release file, from the root directory of that tree.

Note that these commands assume a Linux terminal. If you are using Windows, replace ./bin/daffodil with .\bin\daffodil.bat, and use the appropriate file delimiting character when specifying paths.

Visit the Daffodil Command Line Interface for more detailed usage on the CLI.

There is also a separate example integration of Daffodil into the Calabash XProc processor. See the Daffodil Calabash page.

Comma-separated Values (CSV)

This DFDL schema is found at

We assume you have created a directory named 'examples' in your home directory, and in it you have cloned the CSV git repository via:

cd ~/examples
git clone

A comma-separated value file is a file that contains lines that are table rows. There is a single row of headers followed by one or more rows of data. The header and data rows are separated into data fields by a comma. For information on the file format, visit Comma-separated Values.

$ ./bin/daffodil parse --schema ~/examples/CSV/src/main/resources/com/tresys/csv/xsd/csv.dfdl.xsd ~/examples/CSV/src/test/resources/com/tresys/csv/data/simpleCSV.csv

This is the CSV schema:

<?xml version="1.0" encoding="UTF-8"?> 
Copyright (c) 2012-2015 Tresys Technology, LLC. All rights reserved.
<xs:schema xmlns:xs="" xmlns:fn=""
  xmlns:dfdl="" xmlns:ex=""
  targetNamespace="" elementFormDefault="unqualified">
  <xs:include schemaLocation="xsd/built-in-formats.xsd" />
    <xs:appinfo source="">
      <dfdl:format ref="ex:daffodilTest1" separator="" initiator=""
        terminator="" leadingSkip='0' textTrimKind="none" initiatedContent="no"
        alignment="implicit" alignmentUnits="bits" trailingSkip="0" ignoreCase="no"
        separatorPosition="infix" occursCountKind="parsed"
        emptyValueDelimiterPolicy="both" representation="text" textNumberRep="standard"
        lengthKind="delimited" encoding="ASCII" />
  <xs:element name="file">
      <xs:sequence dfdl:separator="%NL;" dfdl:separatorPosition="postfix">
        <xs:element name="header" minOccurs="0" maxOccurs="1"
            <xs:sequence dfdl:separator=",">
              <xs:element name="title" type="xs:string" maxOccurs="unbounded" />
        <xs:element name="record" maxOccurs="unbounded">
            <xs:sequence dfdl:separator=",">
              <xs:element name="item" type="xs:string" maxOccurs="unbounded"
                dfdl:occursCount="{ fn:count(../../header/title) }"
                dfdl:occursCountKind="expression" />

And this is the data


This is the result of using Daffodil to parse that data:

<ex:file xmlns:ex="">


PCAP - Packet Capture

This DFDL schema is found at

The PCAP file format is a binary file format used to capture network packets. For information on this file format, visit the Wireshark Libpcap File Format page.

We assume you have created a directory named 'examples' and in it you have cloned the PCAP git repository via:

cd ~/examples
git clone

This is the command line.

$ ./bin/daffodil parse --schema ~/examples/PCAP/src/main/resources/com/tresys/pcap/xsd/pcap.dfdl.xsd ~/examples/PCAP/src/test/resources/com/tresys/pcap/data/icmp.cap

The PCAP Schema is not reproduced here simply due to its size.

The data, viewed as a hex dump, looks like this:

examples/pcap/icmp.cap (binary hexdump)
0000000     c3d4 a1b2 0002 0004 0000 0000 0000 0000
0000020     ffff 0000 0001 0000 6fc4 51c1 ccf8 000c
0000040     004a 0000 004a 0000 5000 e056 4914 0c00
0001300     0000 5c2f 0002 0024 6261 6463 6665 6867
0001320     6a69 6c6b 6e6d 706f 7271 7473 7675 6177
0001340     6362 6564 6766 6968

The resulting infoset, in XML looks like:

<pcap:PCAP xmlns:pcap="urn:pcap:2.4">
  • No labels