Parse XML

The Parse XML task is used when you have an XML document stored in a string or binary field.

This task produces a tree representation of the XML that can be used by subsequent tasks in the mediation flow. This task can be paired with the Render XML task to convert the parsed XML back into a string or binary field for transmission within a message.

XML documents are sometimes stored in string or binary fields to improve the performance of message transmission or for other reasons. You may want to view or manipulate the data within the document then replace the document in the message before transmission to a target operation or mediation operation. Also, the target or mediation operation in your mediation flow may expect to receive all or a subset of the fields within the document.

To parse an XML document, you must provide the schema definition for the data. The schema definition must be stored in an XSD within your project. You can use an existing XSD, create an XSD with the XSD editor within TIBCO Business Studio, or you can use your own XSD editor plug-in. See the Eclipse XSD Developer Guide for more information about the XSD editor within TIBCO Business Studio.

The output of the Parse XML task is placed into the contributed data portion of the mediation exchange. An element with the same name as the Parse XML task is placed into the mediation exchange. The XSD specified in the Output Schema field determines the structure of the element.

The Parse XML task can be placed on an input, output, or fault path.

General Tab

Field Description
Name

Assign a name to the task, to identify the task in the mediation flow. This name appears in the tooltip that opens when you hover the cursor over the task icon in the mediation flow.

This is also the name of the element in the mediation exchange that stores the output of this task.

Description Describe the task briefly. This description appears in the tooltip that opens when you hover the cursor over the task icon in the mediation flow.
Output Schema An XSD stored in the workspace that describes the structure of the XML document you want to parse. The output of this task is a parsed XML tree containing the data in the XML document supplied in the Input tab. This output schema is the structure of the element added to the mediation exchange containing the output of this task.
Binary Input

Select this box when the XML document is stored in binary format instead of text format. When this box is not selected, the XML document is expected to be text.

This field controls the input element on the Input tab of this task. When you do not select this field, the input element is a string named xmlString. When you select this field, the input element is a binary element named xmlBinary.

Validate Input

Select this box to enable schema validation of the task input.

If you select this box and the schema validation fails, the error results in a mediation task fault.

If you do not select this box, validation is not performed. A fault is thrown only if a parse error occurs

Input Tab

The Input tab is a mapping panel for mapping data from the mediation exchange to the input fields of this task. See Transforming Tasks for more information about using the mapping panel.

Field Description
TaskInput A complex element to hold the input for this task. The sub-element of this element is the XML document that you want to parse. The Binary Input field on the General tab controls which of the following elements appear.
ParseXmlStringInput Appears when the Binary Input field on the General tab is not selected. Map this element to a string element in the Mediation Exchange that holds the XML document you want to parse.
ParseXmlBinaryInput Appears when the Binary Input field on the General tab is selected. Map this element to a binary element in the Mediation Exchange that holds the XML document you want to parse.

Output Tab

The Output tab is a read-only display of the output schema for this task.