Below are two examples of how Daffodil parses Comma-Separated Values (CSV) and Packet Capture data (PCAP) data to XML. For simplicity, each example uses the Daffodil Command Line Interface to parse input data to output XML.

Comma-Separated Values (CSV)

This DFDL schema is found at the DFDLSchemas GitHub CSV repository.

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

The above command uses the csv.dfdl.xsd schema to parse the simpleCSV.csv input data. The simpleCSV.csv contains the following data:


The result of the parse is the following XML:

<ex:file xmlns:ex="http://example.com">

Packet Capture Data (PCAP)

This DFDL schema is found in the DFDLSchemas GitHub PCAP repository.

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.

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

The above command uses the pcap.dfdl.xsd schema to parse the icmp.cap input file. Viewed as a hex dump, the icmp.cap file looks like:

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 result of the parse is the following XML:

<pcap:PCAP xmlns:pcap="urn:pcap:2.4">