The XML Schema for CDA is part of the CDA materials package that can be downloaded here from the HL7 web site.

If you’re not familiar with XML Schema, the XML Schema tutorial can help.

The lead XML Schema file for CDA is named cda.xsd, and it includes a file named POCD_MT000040.xsd that contains the actual schema definition for CDA.

The XML Schema types of CDA are defined using the the <xs:sequence> tag (refer to xs:sequence in the tutorial noted above) – which mandates that the elements appear in the order they are defined.

The top-level XML data type that the schema defines is named POCD_MT000040.ClinicalDocument. This is the type assigned to ClinicalDocument, the root XML element of a CDA document. Its sub-elements are defined with <xs:sequence>, and must appear in this order (of course, optional sub-elements that are not included can be skipped): realmCode, typeId, templateId, id, code, title, effectiveTime, confidentialityCode, languageCode, setId, versionNumber, copyTime, recordTarget, author, dataEnterer, informant, custodian, informationRecipient, legalAuthenticator, authenticator, participant, inFullfilmentOf, documentationOf, relatedDocument, authorization, componentOf, component.

Similarly, the recordTarget sub-element of ClinicalDocument is defined as being of type POCD_MT000040.RecordTarget and it too is defined with <xs:sequence> – with the following order of sub-elements: realmCode, typeId, templateId, patientRole.

As another example, the observation element located in ClinicalDocument/component/structuredBody/component/section/entry/observation is defined as being of type POCD_MT000040.Observation which is also defined with <xs:sequence>. Its sub-elements are defined in the following order: realmCode, typeId, templateId, id, code, derivationExpr, text, statusCode, effectiveTime, priorityCode, repeatNumber, languageCode, value, interpretationCode, methodCode, targetSiteCode, subject, specimen, performer, author, informant, participant, entryRelationship, reference, precondition, referenceRange.

Recognizing Sequence Issues in Validation Error Messages
The TTT Validator, which is the official C-CDA validation tool of the US Government in the context of MU2, validates CDA files against the CDA XML schema and out-of-sequence elements will trigger an error message.

The output shown below is the result of swapping the templateId and typeId sub-element of ClinicalDocument:

The interpretation of the message is that the templateId element triggered an error. As per the schema rules, at the point in the file where templateId was encountered, the expected/allowed element names are either realmCode (the previous element, which, according to the schema, can have multiple occurrences) or typeId (the element that is supposed to come after realmCode and before templateId).

Other CDA PRO Know Articles Referenced In This Article