Testing a DFDL schema by parsing test input data

You can test-parse sample data against your DFDL message model by using the DFDL Test Perspective.

Before you begin

Create or open a DFDL schema file.

About this task

You can use the DFDL Test Perspective to test-parse sample data against your selected DFDL message, to verify that the DFDL schema is correct.

Procedure

  1. Open the DFDL schema that you want to test.
  2. In the DFDL schema editor, expand the Messages section.
  3. Select the message that you want to test.
  4. Click Test parse model, or right-click the message that you want to test and click Test parse model.
    The Test Parse Model window opens.
  5. In the Parser Input section, select the location of the input data that you want to test-parse:
    • If you have not previously serialized a test message:
      1. Select Content from the file...
      2. In the Input file name field, enter the location of your input data file, or click Browse to locate it.
    • If you have previously serialized a test message, select from the following options:
      • Select Content from the file... to test-parse the contents of an input file, as described in the previous step.
      • Select Content from 'DFDL Test - Serialize' view to test-parse the data that is displayed in the DFDL Test - Serialize view.
  6. Enter Runtime encoding options as required.
  7. Optional: Select Validate data against schema to check for validation errors.
  8. Click OK, and confirm that you want to open the DFDL Test Perspective.

Results

  • The DFDL Test Perspective opens, and the results of your test-parse are displayed in the DFDL Test - Parse view.
  • You can view a log of parser actions in the DFDL Test - Trace view.
  • You can view the logical instance in the DFDL Test - Logical Instance view, as a tree, or as XML.

What to do next

Next:

  • You can continue to edit your DFDL schema by using the DFDL schema editor.
  • You can generate a structural preview of a message from your DFDL schema; see Testing a DFDL schema by creating a logical instance.
  • You can test-serialize data from your DFDL schema, see Testing a DFDL schema by serializing test output data.
  • You can change the following settings, and then test-parse again by clicking the Run Parser button in the DFDL Test - Parse view.
    • In the DFDL Test - Parse view, you can change the input data and encoding.
    • In the Editor, you can select a different message to be test-parsed.
    All other settings from the last test-parse are retained.
  • If the DFDL schema is complete, you can add it to a BAR file for deployment; see Creating a BAR file.

Debugging

About this task

If an error occurs during parsing, the following resources are available to help correct the model:
  • An error message is displayed. The message summarizes the problem, and contains links to view the trace and partial logical instance that was created.
  • The DFDL Test - Parse view shows the location of the error in the data. At the top of this view is a hyperlink that opens the DFDL Test - Trace view.
  • The object in error is marked in the Editor with the following marker: Marker when parsing errors occur.. The error marker has hover help that provides information about the error. To clear the error marker, correct the model and then parse the data again. The error marker is also removed when you close the DFDL editor.
  • The DFDL Test - Logical Instance view shows the infoset parsed up to the error.