You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

The Daffodil Releases come with an example directory containing DFDL schemas and files used to exercise the Daffodil parser. Following are commands that can be run from the root directory of the of the extracted release. Note that these commands assume a Linux terminal. If you are using Windows, replace ./bin/daffodil.sh 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.

PCAP

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.

command
$ ./bin/daffodil.sh parse --schema examples/pcap/pcap.dfdl.xsd examples/pcap/lldp.minimal.pcap
examples/pcap/lldp.minimal.pcap (binary hexdump)
0000000   c3d4 a1b2 0002 0004 0000 0000 0000 0000
0000010   9000 0001 0001 0000 eb1d 42d2 0000 0000
0000020   0040 0000 0040 0000 8001 00c2 0e00 0400
0000030   1f96 26a7 cc88 0702 0004 9604 a71f 0426
0000040   0504 2f31 0633 0002 0678 0002 0601 0002
0000050   0602 0002 0003 ff00 ffff ffff ffff ffff
0000060   ffff ffff ffff bbaa
output
<ex:pcap xmlns:ex="http://example.com">
  <ex:global_header>
    <ex:magic_number>2712847316</ex:magic_number>
    <ex:version_major>2</ex:version_major>
    <ex:version_minor>4</ex:version_minor>
    <ex:thiszone>0</ex:thiszone>
    <ex:sigfigs>0</ex:sigfigs>
    <ex:snaplen>102400</ex:snaplen>
    <ex:network>1</ex:network>
  </ex:global_header>
  <ex:packet>
    <ex:header>
      <ex:ts_sec>1121119005</ex:ts_sec>
      <ex:ts_usec>0</ex:ts_usec>
      <ex:incl_len>64</ex:incl_len>
      <ex:orig_len>64</ex:orig_len>
    </ex:header>
    <ex:data>
      9828969060947146491315229537793021629371354449568752705782309242400521512382137886668471572476688106472422625916232720215517362249495009110292401114742785
    </ex:data>
  </ex:packet>
</ex:pcap>

Comma-separated Values (CSV)

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

command
$ ./bin/daffodil.sh parse --schema examples/csv/csv.dfdl.xsd examples/csv/csv_test.csv
examples/csv/csv_test.csv
last,first,middle,DOB
baratheon,robert,brandon,1988-03-24
johnson,john,henry,1986-01-23
stark,arya,cat,1986-02-19
output
<ex:file xmlns:ex="http://example.com">
  <ex:header>
    <ex:title>last</ex:title>
    <ex:title>first</ex:title>
    <ex:title>middle</ex:title>
    <ex:title>DOB</ex:title>
  </ex:header>
  <ex:record>
    <ex:item>baratheon</ex:item>
    <ex:item>robert</ex:item>
    <ex:item>brandon</ex:item>
    <ex:item>1988-03-24</ex:item>
  </ex:record>
  <ex:record>
    <ex:item>johnson</ex:item>
    <ex:item>john</ex:item>
    <ex:item>henry</ex:item>
    <ex:item>1986-01-23</ex:item>
  </ex:record>
  <ex:record>
    <ex:item>stark</ex:item>
    <ex:item>arya</ex:item>
    <ex:item>cat</ex:item>
    <ex:item>1986-02-19</ex:item>
  </ex:record>
</ex:file>
  • No labels