I m trying to use HAPI to parse HL7 (v2.3) messages generated by an external system. These messages include custom Z segments, including the second segment of the message (between MSH and EVN).
MSH
Z
EVN
...
The problem is that for any segments parsed after encountering this first Z segment, HAPI will generate the message structure but all data in that structure is null. So, I ll still have an EVN segment object, but it won t have any data in it.
I ve tried:
- Nothing, just parse the message with out-of-the-box HAPI, and ignore this segment
- Extending HAPI by creating my own ADT message classes (extending the default classes) connecting in the Z segment with:
- addNonstandardSegment()
- add() with a custom implementation of AbstractSegment
My current workaround is to pre-parse the message before HAPI gets it and cut out this segment, but this is definitely the wrong approach. Does anyone have ideas on what I should be doing?