In responding to this post, I did a test and found out a something that I did not realize:

You need to follow the EXACT naming standard in element declaration. I modified the schema to look like this:

 

<xs:element minOccurs=”1” maxOccurs=”1” name=”MSH.10_MessageControlId“>

<xs:complexType>

 <xs:sequence>

  <xs:element minOccurs=”1” maxOccurs=”1” name=”CM_MSG.0_MessageControlId” type=”ST” />

  <xs:element minOccurs=”0” maxOccurs=”1” name=”CM_MSG.1_X” type=”ST” />

 </xs:sequence>

 </xs:complexType>

</xs:element>

I modified the sample message to look like this:

MSH|^~&|IE|MCM|BTAHL7InterfaceEngine||199601121005||ADT^A03|000001^1|P|2.3.1

 

And the resulting xml looks like this:

<ns0:MSH_24_GLO_DEF xmlns:ns0=”http://microsoft.com/HealthCare/HL7/2X”>

<MSH>

<MSH.2_EncodingCharacters>^~&amp;</MSH.2_EncodingCharacters>

<MSH.3_SendingApplication><HD.0_NamespaceId>IE</HD.0_NamespaceId></MSH.3_SendingApplication>

<MSH.4_SendingFacility><HD.0_NamespaceId>MCM</HD.0_NamespaceId></MSH.4_SendingFacility>

<MSH.5_ReceivingApplication>

   <HD.0_NamespaceId>BTAHL7InterfaceEngine</HD.0_NamespaceId>

</MSH.5_ReceivingApplication>

<MSH.6_ReceivingFacility>

  <HD.0_NamespaceId></HD.0_NamespaceId>

</MSH.6_ReceivingFacility>

<MSH.7_DateTimeOfMessage>

  <TS.1>199601121005</TS.1>

</MSH.7_DateTimeOfMessage>

<MSH.8_Security></MSH.8_Security>

<MSH.9_MessageType>

  <CM_MSG.0_MessageType>ADT</CM_MSG.0_MessageType>

  <CM_MSG.1_TriggerEvent>A03</CM_MSG.1_TriggerEvent>

</MSH.9_MessageType>

<MSH.10_MessageControlId>

  <CM_MSG.0_MessageControlId>000001</CM_MSG.0_MessageControlId>

  <CM_MSG.1_X>1</CM_MSG.1_X>

 </MSH.10_MessageControlId>

<MSH.11_ProcessingId>

  <PT.0_ProcessingId>P</PT.0_ProcessingId>

</MSH.11_ProcessingId>

<MSH.12_VersionId>

  <VID.0_VersionId>2.3.1</VID.0_VersionId>

</MSH.12_VersionId>

</MSH>

</ns0:MSH_24_GLO_DEF>

  2 Responses to “Modifying the MSH Schema for additional sub-elements”

  1. I cut and pasted the changes you made to the schema. I validated the schema in visual studio. Re-deployed everything, but I get the following errors:

    Error # 1
    Segment Id: MSH
    Sequence Number: 1
    Field Number: 10
    Error Number: 207
    Error Description: Application internal error
    Encoding System: HL7nnnn
    Alternate Error Number: Z100
    Alternate Error Description: The element ‘MSH.10_MessageControlId’ has an invalid structure
    Alternate Encoding System: HL7-BTA

    Error # 2
    Segment Id: MSH
    Sequence Number: 1
    Field Number: 10
    Error Number: 101
    Error Description: Required field is missing
    Encoding System: HL7nnnn

    Error # 3
    Segment Id: MSH
    Sequence Number: 1
    Field Number: 10
    Error Number: 102
    Error Description: Data type error
    Encoding System: HL7nnnn

  2. Which version are you using? This was done using 1.3.

   
© 2012 HL7 and BizTalk Blog Suffusion theme by Sayontan Sinha