From: Puyenbroek, J. L. <JEN...@sa...> - 2010-11-16 21:10:29
|
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 jen...@sa... Jp...@cd... Please consider the environment before printing this email. -----Original Message----- From: hl7...@li... [mailto:hl7...@li...] On Behalf Of christian ohr Sent: Thursday, November 04, 2010 4:33 AM To: hl7...@li... 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 > Hl7...@li... > 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 Hl7...@li... https://lists.sourceforge.net/lists/listinfo/hl7api-devel |