Thunder Wiki for Thunder Suite, JSON Thunder & XML Thunder

Adding Processing Instructions to a Handler Definition

Processing Instructions appear at the beginning of many XML documents and are used by applications when parsing the document. They can include information such as the XML version and encoding.

The following outlines the steps required to add Processing Instructions to your XML Thunder Handler design. There are two approaches described. The first approach applies when you are using an XML Schema to create your Handler design and the schema contains the processing instruction information. The second approach applies when you have an existing XML Handler definition and you would like to add Processing Instructions to it.

When you create your handler design using the New Handler Design Wizard, it should appear as shown below. Processing Instruction information will be included. The version and encoding attribute nodes will have a Fixed Value (i.e. a constant) that will always be written when the XML Thunder Writer creates an XML document.
Note that the “Has Data” property is automatically set to “False” and the “Fixed Value” property is populated with the constant.

2. Add additional Processing Instructions

In some cases, you may need to add additional Processing Instruction information. For example, the XML schema may contain only the XML version information – as shown below.

To add additional attributes to the Processing instruction (such as encoding), right click on the attribute list icon in the XML tree and choose “Add -> Attribute.

Enter the name of the new Processing Instruction attribute (e.g. “encoding”).

Set the “Has Data” property to “False” and set the “Fixed Value” that you would to appear in the XML documents that are created.

Sometimes you may want to add Processing Instructions to an existing Handler. Examples of when this may be necessary are:

• You did not use an XML schema to create your XML Handler Definition (e.g. you used a copybook or header file and derived the XML structure, or you used a sample XML instance for the XML structure).

• The schema does not contain Processing Instructions, but you would like to include them in your XML document.

• You have an existing Handler Definition that did not import Processing Instructions and you would like to add them after the fact.

The following outlines the approach for adding Processing Instructions to an existing Handler definition.

1. Click on XML Item -> Add -> Add P.I. Node.

The Processing Instruction node will appear at the bottom of the Handler design. Set the node name to “xml”.

2. Drag the Processing Instruction Node to the Beginning of the XML Structure.

To get the P.I. node to the beginning of the Handler design, drag and drop the node to the top. You may find it helpful to collapse the nodes under the root element (click the “-“ symbol next to a node to collapse its children).