Announcement

Collapse
No announcement yet.

Mirth XML Transformer

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

  • Mirth XML Transformer

    I currently have an XML source that I simply want to interrogate and print out a debug statement. I find that the moment I introduce a transformer to my XML channel, it modifies the output. I use a Javascript step for my transformer. Here are my findings:

    No XML transformer:
    XML IN -> XML OUT (identical)

    Introduce transformer:
    XML IN
    <log the XML in the transformer> (i.e. logger.info(message.toString());
    XML OUT (smaller in size than the original without the original stylesheet).

    I need to preserve my XML payload from input through output. If it gets modified, my consumer cannot process it correctly.

    Any ideas?

    Thanks in advance,
    Tom

  • #2
    Originally posted by rutzelt View Post
    I currently have an XML source that I simply want to interrogate and print out a debug statement. I find that the moment I introduce a transformer to my XML channel, it modifies the output. I use a Javascript step for my transformer. Here are my findings:

    No XML transformer:
    XML IN -> XML OUT (identical)

    Introduce transformer:
    XML IN
    <log the XML in the transformer> (i.e. logger.info(message.toString());
    XML OUT (smaller in size than the original without the original stylesheet).

    I need to preserve my XML payload from input through output. If it gets modified, my consumer cannot process it correctly.

    Any ideas?

    Thanks in advance,
    Tom
    Can you post a sample message? By default "strip namespaces" is turned on, so that may be the issue.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      Thanks for the quick response. I made sure to uncheck 'strip namespaces' in my channel.

      Here is an example source (XML):

      <?xml-stylesheet type='text/xsl' href='http://cdastyle.e-mds.com/cda2.xsl'?>
      <ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:mif="urn:hl7-org:v3/mif" xmlns:sdtc="urn:hl7-org:sdtc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://xreg2.nist.gov:8080/hitspValidation/schema/cdar2c32/infrastructure/cda/C32_CDA.xsd">
      <realmCode code="US"/>
      <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
      <templateId root="2.16.840.1.113883.3.27.1776" assigningAuthorityName="CDA/R2"/>
      <templateId root="2.16.840.1.113883.10.20.1" assigningAuthorityName="CCD"/>
      <templateId root="2.16.840.1.113883.3.88.11.32.1" assigningAuthorityName="HITSP/C32"/>
      <templateId root="2.16.840.1.113883.10.20.3" assigningAuthorityName="CDA4CDT"/>
      <templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.3" assigningAuthorityName="XDS-MS Referral Summary"/>
      <templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.2" extension="IHE"/>
      <templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.5" extension="PHR Extract"/>
      <templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.1"/>
      <templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.10" extension="ED Referral Specification"/>
      <id root="3153ABA9-8CDB-4A81-B441-0D52FA34E323"/>
      <code code="34133-9" codeSystem="2.16.840.1.113883.6.1" displayName="Summarization of episode note"/>
      <title>Chart Summary</title>
      </ClinicalDocument>

      This is the processed result:
      <ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:mif="urn:hl7-org:v3/mif" xmlns:sdtc="urn:hl7-org:sdtc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://xreg2.nist.gov:8080/hitspValidation/schema/cdar2c32/infrastructure/cda/C32_CDA.xsd">
      <realmCode code="US"/>
      <typeId extension="POCD_HD000040" root="2.16.840.1.113883.1.3"/>
      <templateId assigningAuthorityName="CDA/R2" root="2.16.840.1.113883.3.27.1776"/>
      <templateId assigningAuthorityName="CCD" root="2.16.840.1.113883.10.20.1"/>
      <templateId assigningAuthorityName="HITSP/C32" root="2.16.840.1.113883.3.88.11.32.1"/>
      <templateId assigningAuthorityName="CDA4CDT" root="2.16.840.1.113883.10.20.3"/>
      <templateId assigningAuthorityName="XDS-MS Referral Summary" root="1.3.6.1.4.1.19376.1.5.3.1.1.3"/>
      <templateId extension="IHE" root="1.3.6.1.4.1.19376.1.5.3.1.1.2"/>
      <templateId extension="PHR Extract" root="1.3.6.1.4.1.19376.1.5.3.1.1.5"/>
      <templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.1"/>
      <templateId extension="ED Referral Specification" root="1.3.6.1.4.1.19376.1.5.3.1.1.10"/>
      <id root="3153ABA9-8CDB-4A81-B441-0D52FA34E323"/>
      <code code="34133-9" codeSystem="2.16.840.1.113883.6.1" displayName="Summarization of episode note"/>
      <title>Chart Summary</title>
      </ClinicalDocument>

      As you can see, it has been modified even though I did not instruct our transformer to transform the message in any way. I might want to do that in the future however.

      If I remove the transformer step, the output is identical to the input.

      Thanks,
      Tom

      Comment


      • #4
        I forgot to mention, I'm using the latest version of Mirth, Windows 7 64-bit, and Java 7.

        It appears that there could be a bug in the "strip namepaces" function. Have you been able to reproduce the issue? I can do it with an extremely simple case.

        Thanks.

        Comment


        • #5
          Just to update, I've created an issue for this: MIRTH-2441. I've looked through it and am not quite sure why it's happening, though my initial guess is that it may be a limitation of Rhino's implementation of E4X.
          Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

          Nicholas Rupley
          Work: 949-237-6069
          Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


          - How do I foo?
          - You just bar.

          Comment

          Working...
          X