Hi Chandan,

There are two good ways of doing this: you can use the Terser, which
involves something along the lines of
String version = new Terser(yourMsg).get("MSH-12");

or you can use the CanonicalModelClassFactory
<http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/parser/CanonicalModelClassFactory.html>
and configure it to just always use the highest version of HL7 you want to
support. This is my preferred approach personally, and it works well
because HL7 structures are basically backwards compatible (they add things
and deprecate things, but they never remove anything).

Cheers,
James

On Mon, Nov 3, 2014 at 11:25 PM, Chandan Datta <chandan.da...@auckland.ac.nz
> wrote:

> Hi,
> I am trying to create a Hl7 to XML transformer which will support multiple
> versions of Hl7 (such as v2.3 RSD/v2.4 RSD) files present in a directory.
> Is there a way to detect the version from the MSH segment before initiating
> HAPI?
>
> --
> Regards,
> Chandan
> Doctoral student,Robotics Research Group
> University of Auckland, New Zealand
> ​
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Hl7api-devel mailing list
> Hl7api-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
------------------------------------------------------------------------------
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to