Implementing HL7 v3 Using the .NET Framework 1.1

Here are some tips and tricks for you if you're implementing (or planning to implement) HL7 v3 using the .NET Framework v1.1.

The first thing to do after downloading the HL7 v3 schemas from the HL7 web site is patch them to include the target and default namespaces in datatypes.xsd, datatypes-base.xsd, voc.xsd. The reason for this is that .NET Framework 1.1 does not support chameleon include as detailed in Q317611.

This is easy and you just need to add the following attributes to the <xs:schema/> element in the above mentioned files:

targetNamespace="urn:hl7-org:v3" xmlns="urn:hl7-org:v3"

The other thing you might want to do is move all the schemas in the same directory. This is again fairly easy to do by copying the schemas in the coreschemas directory and doing a search for "../coreschemas/" and replace it with "".

Last thing is related to the advanced use of some XSD features in the HL7 v3 schemas. The .NET Framework v1.1 does not support validation of instances with fixed attributes in the schema coming from a union as in the following fragment of schema declaration:

<xs:attribute name="typeCode" type="ActRelationshipType" use="optional" fixed="SUBJ"/>

The issue and the fix are described in Q842832. The list of fixes included in rollup package 8 are described in Q890673.

The good news is that the .NET Framework 2.0 has none of the issues described and the HL7 v3 schemas work right out of the box.

Happy coding!