Table of Contents

Search

  1. Preface
  2. XML Concepts
  3. Using XML with PowerCenter
  4. Working with XML Sources
  5. Using the XML Editor
  6. Working with XML Targets
  7. XML Source Qualifier Transformation
  8. Midstream XML Transformations
  9. XML Datatype Reference
  10. XPath Query Functions Reference

XML Guide

XML Guide

XML Parser Input Validation

XML Parser Input Validation

You can configure the XML Parser transformation to validate XML before parsing it. The XML Parser transformation validates the XML against a schema. If the XML is not valid for the schema, a row error occurs. The XML Parser transformation returns the XML and associated error messages to a separate output group. You can pass the invalid XML and error message to a target.
For example, a real-time PowerCenter session reads XML messages from a WebSphere MQSeries source. The session runs with a source-based commit. A message in the commit transaction has an invalid XML payload. To prevent the commit from failing, you can configure the XML Parser transformation to return the invalid XML to a separate output group from the valid data. The XML Parser transformation processes the valid XML messages and completes the transaction.
The session log contains a message that indicates when Route Invalid Payload Through Data Flow is enabled. When you set the session tracing level to Normal, the Integration Service writes a message to the session log that indicates whether the validation is successful. The log message contains the location of the schema the XML Parser accessed to validate the XML. When XML streaming is enabled and the XML is invalid, the Integration Service truncates the XML and passes it to the Invalid_Payload port. The Integration Service logs the invalid XML in the session log.
To configure the XML Parser transformation to validate the XML, enable the Route Invalid Payload Through Data Flow option on the Midstream XML Parser tab. The Designer adds the following ports to the XML Parser transformation:
  • Invalid_Payload
    . Returns invalid XML messages to the pipeline. If the XML payload is valid, the Invalid_Payload port contains a null value. This port has the same precision as the DataInput port.
  • Error_Status
    . Contains the error string or status returned from the XML validation. If the XML is valid for the current row, Error_Status contains a null value. This port has the same precision as the DataInput port.
The following figure shows an XML Parser transformation that routes invalid XML messages to an Errors target table:
The mapping contains an MQSeries source, and MQ Source Qualifier, and an XML Parser transformation that passes data to two targets. One target is for valid XML messages. The other target for invalid XML messages.
The mapping contains the following objects:
  • MQSeries source definition.
    Contains employee XML data in the message data field.
  • Source Qualifier transformation
    . Reads data from WebSphere MQ. Contains a set of ports that represent the message header fields and the message data field.
  • XML Parser transformation
    . Receives the XML message data in the DataInput port. When the XML is valid, the XML Parser transformation returns the employee data and passes it to a target. When the XML is not valid, the XML Parser transformation returns the XML in the Invalid_Payload port. It returns an error message in the Error_Status port.
  • Employees target definition
    . Receives rows of valid employee data.
  • XML_Errors target definition.
    Receives invalid XML and error messages.
Configure the XML Schema Location attribute in the session properties for the transformation. Enter the name and location of the schema to validate the XML against. You can configure workflow, session, or mapping variables and parameters for the XML schema definition. You can configure multiple schemas for validation if you separate them with semi-colons.
You can use a DTD for validation if you include it in the input XML payload. You cannot configure a DTD in the XML Schema Location attribute or use it to route invalid XML data to the Invalid Payload port.
If you enable XML streaming, verify that the precision for the Invalid_Payload port matches the maximum message size. If the port precision is less than the message size, the XML Parser transformation returns truncated XML in the Invalid_Payload port, and writes an error in the session log.

0 COMMENTS

We’d like to hear from you!