When parsing piped message to XML the formatting in the XML elements introduces 
line breaks. This gives us an issue when inserting data to database regarding 
the length and it also gives us an issue when doing transformations.


Java snippet
    public String getPipedMsgAsXML(Message message, String messageType) throws 
HL7Exception {
            String xmlString = null;

            if (messageType.equals("ORU_R01"))
            {
                ca.uhn.hl7v2.model.v24.message.ORU_R01  msg_OUR_R01 = 
(ca.uhn.hl7v2.model.v24.message.ORU_R01)message;
                DefaultXMLParser defaultXMLParser = new DefaultXMLParser();
                xmlString = defaultXMLParser.encode(msg_OUR_R01);
            }

            return xmlString;
    }

Piped
OBX|1|NM|NPU12518^1234567890123456789012345678901234567890123456789012 3 4 5 6 
7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 
7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 
^NKMB^AB-SBE^SBE^PNA||10.6|mmol/L||H|||F|||201101250001||^^|

XML
            <OUL_R22.RESULT>
                <OBX>
                    <OBX.1>1</OBX.1>
                    <OBX.2>NM</OBX.2>
                    <OBX.3>
                        <CWE.1>NPU12518</CWE.1>

                        
<CWE.2>1234567890123456789012345678901234567890123456789012
                            3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
                            5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6
                            7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 </CWE.2>
                        <CWE.3>NKMB</CWE.3>
                        <CWE.4>AB-SBE</CWE.4>
                        <CWE.5>SBE</CWE.5>
                        <CWE.6>PNA</CWE.6>
                    </OBX.3>
                    <OBX.5>10.6</OBX.5>
                    <OBX.6>
                        <CWE.1>mmol/L</CWE.1>
                    </OBX.6>
                    <OBX.8>H</OBX.8>
                    <OBX.11>F</OBX.11>
                    <OBX.14>201101250001</OBX.14>
                </OBX>
            </OUL_R22.RESULT>


Desired XML

                    <OBX.3>
                        <CWE.1>NPU12518</CWE.1>
                        
<CWE.2>1234567890123456789012345678901234567890123456789012 3 4 5 6 7 8 9 0 1 2 
3 4 5 6 7 8 9 0 1 2 3 4  5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
2 3 4 5 6 7 8 9 0 1 2 </CWE.2>
                        <CWE.3>NKMB</CWE.3>
                        <CWE.4>AB-SBE</CWE.4>
                        <CWE.5>SBE</CWE.5>
                        <CWE.6>PNA</CWE.6>
                    </OBX.3>

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to