A HL7 message instance does not require the vertical bar at the end of a
segment.   

-Jenni
Jennifer L. Puyenbroek, PMP
Science Applications International Corporation (SAIC)
Office of Surveillance, Epidemiology, and Laboratory Services (OSELS)
Centers for Disease Control and Prevention
770-452-5807 Office
678-361-2099 Mobile
770-934-0829 Fax
[email protected]
[email protected] 
Please consider the environment before printing this email. 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
christian ohr
Sent: Thursday, November 04, 2010 4:33 AM
To: [email protected]
Subject: Re: [HAPI-devel] Parse a simple message HL7 v2.6


Hi,

you need a pipe after the 2.6 and separate the segments with \r. This
works:

        public static void main(String[] args) {
                String msg =
"MSH|^~\\&|HUB||server||201010172015||ACK^W01^ACK|1234|P|2.6|\r"
                                + "MSA|AA|2468|\n";

                Parser p = new GenericParser();

                Message hapiMsg;
                try {
                        // The parse method performs the actual parsing
                        hapiMsg = p.parse(msg);
                } catch (EncodingNotSupportedException e) {
                        e.printStackTrace();
                        return;
                } catch (HL7Exception e) {
                        e.printStackTrace();
                        return;
                }
        }

=>

04.11.2010 09:31:59 ca.uhn.log.HapiLogImpl info
INFO: Instantiating msg of class ca.uhn.hl7v2.model.v26.message.ACK


regards
Christian



William Smith-12 wrote:
> 
> I have troubles to parse a string with HAPI (*HL7 v2.6*).
> 
> This is my code:
> 
> 
> public static void main(String[] args) {
>         String msg = "MSH|^~
> \\&|HUB||server||201010172015||ACK^W01^ACK|1234|P|2.6<cr>"
>                 + "MSA|AA|2468|<cr>";
> 
>          Parser p = new GenericParser();
> 
>         Message hapiMsg;
>         try {
>             // The parse method performs the actual parsing
>             hapiMsg = p.parse(msg);
>         } catch (EncodingNotSupportedException e) {
>             e.printStackTrace();
>             return;
>         } catch (HL7Exception e) {
>             e.printStackTrace();
>             return;
>         }
> 
> It throws a HL7Exception.
> 
>
------------------------------------------------------------------------
------
> Achieve Improved Network Security with IP and DNS Reputation.
> Defend against bad network traffic, including botnets, malware, 
> phishing sites, and compromised hosts - saving your company time, 
> money, and embarrassment.   Learn More! 
> http://p.sf.net/sfu/hpdev2dev-nov
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
> 
> 

-- 
View this message in context:
http://old.nabble.com/Parse-a-simple-message-HL7-v2.6-tp30125416p3012990
2.html
Sent from the hl7api-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------
------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to