When processing an inbound EDI transaction, the following exception is thrown: org.xml.sax.SAXException: validation error: unexpected text occurs when processing EDI data.

When processing an inbound EDI transaction, the following exception is thrown: org.xml.sax.SAXException: validation error: unexpected text occurs when processing EDI data.

book

Article ID: KB0093476

calendar_today

Updated On:

Products Versions
TIBCO BusinessConnect EDI Protocol Powered by Instream -
Not Applicable -

Description

Description:
When processing an inbound EDI transaction, the following exception is thrown:  org.xml.sax.SAXException: validation error: unexpected text occurs when processing EDI data.
Symptoms:
In the BusinessConnect log, the following exception is seen and the Audit Log shows conversion errors for the transaction.

caused by: org.xml.sax.SAXException: validation error: unexpected text   ({com.tibco.xml.validation}COMPLEX_E_UNEXPECTED_TEXT) at /{http://www.tibco.com/ns/ax/bc/EDI/2002/10/aeschema}ResponderRequestOutput[1]/{http://www.tibco.com/ns/ax/bc/EDI/2002/10/aeschema}body[1]com.tibco.xml.validation.exception.UnexpectedTextException: unexpected text

 at com.tibco.xml.validation.state.driver.ValidationJazz.text(ValidationJazz.java:1230)

 at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:104)

 at com.tibco.xml.validation.state



Cause:
The value of ISA16 (0x0F) of the inbound data is invalid for XML data conversion. The converted XML contain ISA16 element in L-ISA part which is why both Jaxp and BW palette cannot parse and convert the XML data.

Issue/Introduction

When processing an inbound EDI transaction, the following exception is thrown: org.xml.sax.SAXException: validation error: unexpected text occurs when processing EDI data.

Resolution

The XML characters generated must be valid XML characters.  Valid xml characters can be found in http://www.w3.org/TR/REC-xml/#charsets.  Here is an excerpt from the standard:

character is an atomic unit of text as specified by ISO/IEC 10646:2000 [ISO/IEC 10646]. Legal characters are tab, carriage return, line feed and the legal characters of Unicode and ISO/IEC 10646. The versions of these standards cited in A.1 Normative References were current at the time this document was prepared. New characters may be added to these standards by amendments or new editions. Consequently, XML processors must accept any character in the range specified for Char. ]

Character Range
[2]   Char   ::=   #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */


Workaround:

Modify the .EX map file as follows:

Find this line:

    <Map>
      <From key="//ISA//16" />
      <To key="T-811/L-ISA/S-ISA/E-I15_ISA_16" />
    </Map>

and modify it to substitute a valid XML character for the invalid one. In this example, "$"  is substituted for for the 0x15 character.

    <Map>
      <From key="//ISA//16" />
      <To key="T-811/L-ISA/S-ISA/E-I15_ISA_16">
        <Rule value="RULES.Value.ReplaceWith { &quot;$&quot; &quot;&quot;}" />
      </To>
    </Map>


This substitution will produce a parse-able XML payload for BW to process.