Announcement

Collapse
No announcement yet.

An invalid XML character (Unicode: 0x0) was found Error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • An invalid XML character (Unicode: 0x0) was found Error

    I am using Mirth 3.9.0.

    I have a channel with source as File reader with source as Delimited Text.

    I am trying to read a .csv batch file and have set column and record delimiter. While running the channel, it is reading each record and getting failed in Source with error as below.

    Transformer error
    ERROR MESSAGE: Error evaluating transformer
    com.mirth.connect.server.MirthJavascriptTransforme rException:
    CHANNEL: NPIReader2
    CONNECTOR: sourceConnector
    SCRIPT SOURCE:
    SOURCE CODE:
    94: }
    95: eval('importPackage(' + Packages.java.lang.Class.forName(className).getPac kage().getName() + ')');
    96: }
    97: }
    98: function doScript() {
    99: msg = new XML(connectorMessage.getTransformedData());
    100: if (msg.namespace('') != undefined) { default xml namespace = msg.namespace(''); } else { default xml namespace = ''; }
    101: function doFilter() { phase[0] = 'filter'; return true; }function doTransform() { phase[0] = 'transformer'; logger = Packages.org.apache.log4j.Logger.getLogger(phase[0]);
    102:
    103:
    LINE NUMBER: 99
    DETAILS: TypeError: An invalid XML character (Unicode: 0x0) was found in the element content of the document.
    at d2be1989-f4d1-4e82-811c-f0e6f28342be:99 (doScript)
    at d2be1989-f4d1-4e82-811c-f0e6f28342be:127


    Can someone help what preprocessor I can use to remove this unwanted chars from input.
    Tried using below but it didn't help.

    return message.replace(/\0x0/g,"");


  • #2
    narupley

    jackwhaines

    agermano

    albertosaez

    Thanks.

    Comment


    • #3
      With Batch enabled, the splitter runs, THEN the preprocessor runs, so you have to remove the nulls (0x0) BEFORE sending to the batch channel. To correct this, have one channel (without batch) that runs the replace preprocessor, then send the data to a channel that does the batching. It may not be the most elegant solution, but it does work.

      -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
      -= [email protected]
      -= Mirth Connect (Advanced)-certified
      -= Gold member of HL7.org
      -= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines

      Comment


      • #4
        It worked that way.. Thanks.. jackwhaines

        Comment

        Working...
        X