Parse XML

Parse XML is a synchronous activity that takes a binary XML file or an XML string and converts it into an XML schema tree based on the XSD specified.

Parsing Date and Datetime Strings

In XML documents parsed by the Parse XML activity, datetime values are read in accordance with the ISO-8601 standard, as described in the XML Schema specification. For example, the value:

2002-02-10T14:55:31.112-08:00

is 55 minutes, 31 seconds, and 112 milliseconds after 2.00 p.m. on February 10th, 2002 in a time zone that is 8 hours, 0 minutes behind UTC.

If no time zone field is present, the value is interpreted in the time zone of the machine that is performing the parsing. This can lead to complications if you are processing XML from a different time zone, so you are encouraged to always use a time zone.

The General tab has the following fields.

Field Description
Name The name to be displayed as the label for the activity in the process.
Input Style Can be Binary, Text, or Dynamic.

In Binary mode, the binary content is read. The encoding used for parsing the content is either the value specified in the forceEncoding input item, the encoding specified in the XML header or the xmlBinary input item, or UTF-8 (the default encoding, if no encoding is specified).

In Text mode, (the default and preferred choice) an XML string is passed as an input item.

In Dynamic mode, a choice is offered for input. You can either supply binary or text input. You can use a choice statement and set substitution in the mapping to supply the correct type of input at run time.

Validate Output When selected, specifies that the output of the activity should be validated against the schema specified in the Output Editor tab.

Description

Provide a short description for the activity.

Output Editor

Use the Output Editor tab to define a schema for the XML output.

Input

The following is the input for the activity.

Input Item Datatype Description
xmlString string The XML string to parse.

This input element is available when the Input Style field in the General tab is set to Text.

xmlBinary complex Available when you set the Input Style field in the General tab to Binary.

This input item contains a required bytes item for which you specify the input XML bytes.

This input item also contains an optional forceEncoding item. This specifies the encoding to use when parsing the XML. If this element is not specified, the encoding specified in the XML header of the byte element is used to parse the XML. If the encoding value is not specified in the XML header, the default encoding (UTF-8) is used.

xmlBinary|xmlString choice Available when the Input Style in the General field is set to Dynamic.

You can specify a choice statement and set substitution and supply the correct input type at run time.

Output

The following is the output of the activity.

Output Item Datatype Description
XML Schema complex The parsed XML schema is the output of this activity. The contents of the schema are determined by the schema defined in the Output Editor tab.

Fault

The Fault tab lists the possible exceptions generated by this activity. For more information about error codes and the corrective action to take, see the TIBCO ActiveMatrix BusinessWorks™ Error Codes guide.

Fault Generated When..
XMLParseException An exception occurred when parsing the data.
UnsupportedEncodingException An unsupported encoding was specified in the forceEncoding input item.
MissingByteCountException An exception occurred while parsing the data with an invalid or missing byte count.
ValidationException The file specifies a version of XML that the parser is not prepared to handle.