Hello, i received this message from a remote system:
MSH|^~\&|G2|Insiel|RIS|Syncromed|20070702090200+0000||ADT^A08^ADT_A01|G2070000003114850300|P|2.5||||||8859/1 PID|||9056752||RUBINI^RENATO||19431020000000+0000|M|||VIA DELLE BORRE 26^^036017^^41052~VIA DELLE BORRE 26^^036017^^41052^^M||||||||||||036017|||100 This message is obviously wrong, because the segment PV1, which is mandatory, is absent. I parse this message with the following java code: String msg6 = "MSH|^~\\&|G2|Insiel|RIS|Syncromed|200707020902||ADT^A08|G2070000003114850300|P|2.5|\r" + "PID|||9056752||RUBINI^RENATO^^^^^L||194310200000|M|||VIA DELLE BORRE 26^^036017^^41052^^L41052~VIA DELLE BORRE 26^^036017^^41052^^M|||||||RBNRNT43R20E264C|46394391||||036017|||100"; String[] messages = {msg6}; PipeParser hapiPipeParser = new PipeParser(); try { hapiMsg = hapiPipeParser.parse(msg6); } catch (EncodingNotSupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (HL7Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } Document hapidoc = null; DefaultXMLParser xmlparse = new DefaultXMLParser(); try { hapidoc = xmlparse.encodeDocument(hapiMsg); } catch (HL7Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } And the result is the following: <ADT_A01> <MSH> <MSH.1>|</MSH.1> <MSH.2>^~\&</MSH.2> <MSH.3> <HD.1>G2</HD.1> </MSH.3> <MSH.4> <HD.1>Insiel</HD.1> </MSH.4> <MSH.5> <HD.1>RIS</HD.1> </MSH.5> <MSH.6> <HD.1>Syncromed</HD.1> </MSH.6> <MSH.7> <TS.1>200707020902</TS.1> </MSH.7> <MSH.9> <MSG.1>ADT</MSG.1> <MSG.2>A08</MSG.2> </MSH.9> <MSH.10>G2070000003114850300</MSH.10> <MSH.11> <PT.1>P</PT.1> </MSH.11> <MSH.12> <VID.1>2.5</VID.1> </MSH.12> </MSH> <SFT/> <EVN/> <PID> <PID.3> <CX.1>9056752</CX.1> </PID.3> <PID.5> <XPN.1> <FN.1>RUBINI</FN.1> </XPN.1> <XPN.2>RENATO</XPN.2> <XPN.7>L</XPN.7> </PID.5> <PID.7> <TS.1>194310200000</TS.1> </PID.7> <PID.8>M</PID.8> <PID.11> <XAD.1> <SAD.1>VIA DELLE BORRE 26</SAD.1> </XAD.1> <XAD.3>036017</XAD.3> <XAD.5>41052</XAD.5> <XAD.7>L41052</XAD.7> </PID.11> <PID.11> <XAD.1> <SAD.1>VIA DELLE BORRE 26</SAD.1> </XAD.1> <XAD.3>036017</XAD.3> <XAD.5>41052</XAD.5> <XAD.7>M</XAD.7> </PID.11> <PID.18> <CX.1>RBNRNT43R20E264C</CX.1> </PID.18> <PID.19>46394391</PID.19> <PID.23>036017</PID.23> <PID.26> <CE.1>100</CE.1> </PID.26> </PID> </ADT_A01> It seems that Hapi creates empty segments, if not present in the incoming message, but only up to the last existing segment. Why it does not create empty segments for the following segments ? And why it does not throw any exception when a Mandatory segment is not present in the message? If this is a feature and not a bug, somebody can explain to me how to implement this check? Is it possible to use the Validators (ValidationContextImpl) for this? Maybe somebody has already a class that does this kind of job. If this is a bug, is there a bug ticket opened? Or should i open one? greetings, Fabio Daprile -- ------------------------------------------------------------------------ Fabio Daprile via Galilei, 2 39100 Bolzano (BZ) - Italy Mobile +39 3491204973 tel. +39.0471065901 fax. +39.0471065919 e-mail [EMAIL PROTECTED] ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Hl7api-devel mailing list Hl7api-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hl7api-devel