IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only

Dealing with non XML entities in XML data

  • 1.  Dealing with non XML entities in XML data

    Posted 10/16/17 12:32 PM

    Originally posted by: PaulBrett


    I have an issue recently where XML data contained an invalid character:

    <Data>Paul's test string</Data>

    You will note that the character after Paul but before s is not an apostrophe, but instead a single right quote.  In hex, the data is:

    00000001: 3C 44 61 74 61 3E 50 61 75 6C 92 73 20 74 65 73 | <Data>Paul's tes
    00000002: 74 20 73 74 72 69 6E 67 3C 2F 44 61 74 61 3E    | t string</Data>

    ...and an attempt to may this data in ITX (or indeed most XML validation software) will result in an error, specifically for ITX:

    External Parser returned Error:
    TYPE X'0001' (Error (-1), "XMLParser: Error(s) occurred."
    SAXParseException, Fatal error [line: 1 column: 39] An exception occurred! Type:UTFDataFormatException, Message:invalid byte 1 (') of a 1-byte sequence.).

    So, how to deal with it?

    Attached is an example I have created.  Test1 demonstrates the issue, and Test2 demonstrates one way of dealing with it (within the map) changing the character to an XML entity for an apostrophe (&apos;).

    Thank you.

    Paul.

    Follow me on Twitter


    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange