How the codec treats messages
- Escapes:
\F\ \S\ \T\ \R\ \E\ \P\ \Xhh\are decoded. Formatting escapes (\H\ \N\ \.br\ \Cxxyy\) are kept verbatim and re-emitted unchanged, so decode → encode round-trips. - Delimiters come from each message's own MSH-1/MSH-2 (and FHS/BHS for a batch), so any punctuation works and every message in a batch may use different ones. ACKs use the inbound message's delimiters.
- HL7 extensions are kept: fields, components, sub-components or repetitions the XSD doesn't define get generic names in the schema's style, are reported as warnings, left out of validation, and encoded back unchanged. Set
allowUndefinedContentto false to make them errors. - Z-segments the XSD doesn't define are kept the same way (
allowUndefinedZSegments). - Segment groups are matched against the schema. Out-of-sequence or unknown segments are reported (code 100) and still written, so no data is lost.
- Batches: each message is decoded on its own; the BTS-1 count is checked (warning); the batch ACK wraps the ACKs in FHS/BHS … BTS/FTS.