No announcement yet.

Handling illegal XML in Mirth v3

  • Filter
  • Time
  • Show
Clear All
new posts

  • Handling illegal XML in Mirth v3

    Mirth Versions in use: V2 and V3 (at different clients)
    Database: PostgreSQL
    Problem: Version3 sites creating errors due to illegal XML characters.
    Channels are LLP Listeners.

    From my reading in these forums, I see the reason that the built-in function "Remove Illegal XML characters" no longer corrects the issue is due to the fact that the Raw Data is persisted to the database. This apparently occurs prior to the Preprocessor code execution.

    The correct solution in these discussions seems to be to use an "Attachment Script".

    I am having a difficult time grasping exactly what this means or how to code/implement it.

    The offending part of the message is the OBX segment. I do not have the option of requesting that the senders (independent clients) modify their feeds.

    Would there be any more detailed references to or actual examples of this solution? Any help would be appreciated as these errors are compounding by the day at our Mirth v3 sites.

    Thank you,.

  • #2
    In the channel summary tab you can set the Attachment option to Javascript. Then in the properties you can add the function to remove the invalid characters.
    You can just return message.replace(blah blah blah);


    • #3
      Thank you for your quick reply. I will try this approach to see if I can address this issue.


      • #4
        I just wanted to follow up on this thread. This worked very well for me.

        Essentially, it moves the script which removes illegal XML characters from the Preprocessor to the Attachment processing - the difference being that the attachment script occurs prior to storing the raw data whereas the preprocessor script occurs after.

        There is no actual attachment, so this is, in effect, a workaround using the timing cycle involved in processing messages.

        Thanks for the help.