Readme file for HL7 Schema Tightener v1.71
Please see disclaimer at www.nprogram.co.uk/disclaimer.htm before use.
A weakness of some current HL7 v3 schemas, including those issued as standard by Connecting for Health in the UK,
is that the presence of structural attributes in message instances cannot be enforced.
The tightener works by looking for attributes that are declared as use="optional" and that have a default value
<xs:attribute name="classCode" type="EntityClass" use="optional" default="ORG"/>
The "structural" attributes of the HL7 RIM are declared like this in current generation HL7 schemas.
The default is the value that will be inferred from the schema if the attribute is not physically present in the XML instance.
CfH rules state that these attributes should be sent, hence are not really meant to be "optional".
The tightener converts these attributes to be use="required".
Once the attribute is "required" it must always be present, hence XML schema does not allow specifying a default.
It could never be used, since it is only for the case when the attribute is not there, never in the case of a required attribute.
Although it would be helpful to set the default value to be a fixed one, it is generally too restrictive to do so,
since subtypes of that default are often legal. This is something that may be addressed in a future version of the tightener.
In addition to enforcing structural attributes the tightener can check the correct use of OIDs,
if these are represented in a parameter file : SchemaTightenerTypesList.xml
Entries in this file cause new complexTypes to be created in place of the originals, which force II or CV datatypes to have fixed OIDs.
See the file itself for details.
The schema tightener is an XSLT transform that can be run with any suitable engine, including Altova XMLSpy,
AltovaXML command line engine, Saxon and Microsoft's MSXSL. When run against an XSD schema file the result is
an equivalent "strict" schema that can be used in its place to perform extra checking of instances.
Typically this would be run against all the schemas in a CfH MiM release.