Using the XML Toolkit

This document covers the following topics:


General Information

The XML toolkit is the tool of choice when you want to generate aids for the processing of XML documents within Natural. It is a wizard which makes use of the objects in the Eclipse workspace. Different input files are possible:

  • XML schema.

  • Document type definition (DTD).

  • Natural data area (local data area, global data area or parameter data area).

Depending on the input file, the XML toolkit generates the appropriate output files:

  • A parser implementation for the PARSE statement.

  • A serializer implementation which uses the COMPRESS statement.

  • A corresponding Natural data area.

  • A corresponding XML schema.

  • A corresponding DTD.

This is illustrated in the following graphics.

  • Input: XML Schema or DTD
    When the input file is an XML schema or DTD, the XML toolkit can produce a Natural data area, a parser implementation and/or a serializer implementation.

    graphics/use-xmltoolkit-schema-in.png

    Caution:
    Byte order marks (BOMs) in XML schema and DTD input files are currently not supported. If the input file contains a BOM, a parsing error will occur. As a workaround, you have to remove the BOM manually.

  • Input: Natural Data Area
    When the input file is a Natural data area, the XML toolkit can produce a parser implementation, a serializer implementation, an XML schema and/or a DTD.

    graphics/use-xmltoolkit-datastructure-in.png

For more information on the XML toolkit, see Web Technology in the Natural documentation for the appropriate platform.

Generating the Output Files

In order to generate the above mentioned output files, you use the XML toolkit as described below.

Start of instruction setTo generate output files

  1. In the Project Explorer view or in the Natural Navigator view, select the object that you want to use as the input file.

  2. From the File menu, choose New > Other. In the resulting New dialog box, expand the Natural node, select XML Toolkit and then choose the Next button.

    The following dialog box appears (in this example, a DTD has been selected).

    XML Toolkit

  3. From the Start element drop-down list box, select the element that is to be used as the basis for the generated output file (for example, select the DTD element that is to be the basis for a new parameter data area).

  4. Choose the Next button.

    The following is now shown. You can create up to 3 different output files at the same time.

    XML Toolkit

  5. Enter a name for at least one output file and select the type of file (for example, copycode) that is to be generated.

  6. Optional. If you want to change the default values for the generation, choose the Next button.

    On the next two pages, you can change the Natural defaults and the XML defaults. These values are taken from the Natural preferences. See XML Toolkit in Setting the Preferences for further information on these defaults.

  7. To start the generation, choose the Finish button.

    As a result of the generation, an editor window is opened for each generated output file. Each new object is shown in the Project Explorer view or in the Natural Navigator view, in the same library as the corresponding input file.

Displaying the Settings of the Last Generation

When you display the Properties dialog box for the file that was used as the input object for the generation, you can see the settings (for example, the replacements for the Natural variable names) that have been used for the last generation.