HL7 2.X and 2.XML Schemas


The HL7 organization publishes two sets of schemas: HL7 2.X schemas, used for HL7-encoded messages, and HL7 2.XML schemas, used for XML-encoded messages.

Microsoft BizTalk Accelerator for HL7 (BTAHL7) works natively with the HL7 2.X schemas. BTAHL7 setup loads the HL7 2.X schema files into <drive>:\program files\Microsoft BizTalk <version> Accelerator for HL7\Templates\Schemas\2.X. As a result, the HL7 2.X schemas are available in the HL7 Schema Selector. You run the HL7 Schema Selector in MicrosoftVisual Studio.

BTAHL7 works with the HL7 2.XML schemas, but the BTAHL7 setup program does not load the HL7 2.XML schemas with the BTAHL7 program files, and you have to modify some of the HL7 2.XML schemas for them to work with BTAHL7. To make them available in the HL7 Schema Selector and make the required modifications, download the 2.XML schemas from the HL7 organization Web site, and then run the Update2XMLSchema tool (for more information, see Update2XMLSchema Tool). The tool will modify the HL7 2.XML schemas as required to work with BizTalk Server, and then place them in <drive>:\program files\Microsoft BizTalk <version> Accelerator for HL7\Templates\Schemas.

Each of these sets of schemas includes a series of versions. HL7 2.X live schema versions include 2.1 through 2.5 (for more information, see HL7 Versions). HL72.XML schema versions include 2.3.1, 2.4, and 2.5. HL7 2.X schema versions are backward compliant. HL7 2.XML schema versions are not backward compliant.

System_CAPS_ICON_note.jpg Note

Because version 2.4 of 2.XML is not backward compliant with 2.3.1 for 2.XML, an error may occur if you deploy a 2.4 version of the 2.XML schema, and then submit an instance of a message conforming to the 2.3.1 version. To correct this, you may need to create a different target namespace to deal with 2.3.1 messages.

When you create a multi-part HL7 2.X message, you must set the type of the body part to a specific schema. If not, the serializer will reject the message.

The following table describes the two basic types of schemas with which BTAHL7 works.

Schema TypeDescription
HL7FF – ER7 Encoded (2.X) SchemasBTAHL7 provides HL7 2.X schemas derived from the HL7 Access database, including:

- A set of all specific schemas based on version, message type, or event
- Common schemas for segments, data types, tables, headers, and acknowledgments (ACKs)

BTAHL7 supports the following schema templates:

- V2.1
- V2.2
- V2.3
- V2.3.1
- V2.4
- V2.5

BTAHL7 setup installs V2.X schemas in <drive>\Program Files\Microsoft BizTalk Accelerator for HL7\Templates\Schemas.
HL7XML – 2.XML EncodingBTAHL7 supports the following schemas:

- V2.3.1
- V2.4
- V2.5

BTAHL7 setup does not install the 2.XML schemas. To install them and modify them to work with BizTalk Editor, see Update2XMLSchema Tool.

BTAHL7 uses an HL7 schema specific to a message type to create and validate the body of an instance of that message type. It also uses common schemas, in addition to the specific schemas. BTAHL7 uses common HL7 schemas to validate HL7 message headers and acknowledgments. These files are MSH_25_GLO_DEF.xsd for headers and ACK_24_GLO_DEF for acknowledgments.

BTAHL7 also uses common schemas to validate data types, segments, and table values. These schemas are specific to each version of the HL7 standards. For instance, the common schemas for V2.2 messages are datatype_22.xsd, segments_22.xsd, and tablevalues_22.xsd. BTAHL7 uses these schemas to validate data types, segments, and table values for all V2.2 messages.

Message Processing
BTAHL72X Flat File Processing
BTAHL72XML Processing
Processing HL7 Messages
Using HL7 2.X Schemas
Using HL7 2.XML Schemas