Skip to main content

Search 436 pages — tools, formats, elements, namespaces, directory, comparisons, XPath, datatypes, glossary, parse errors, schema errors, use cases, guides, blog and product.

XML format

HL7 CDA

A clinical document that is both human-readable and machine-processable, where the narrative block is the legally authoritative part.

CDA Release 2 is the XML behind discharge summaries, referrals and the continuity-of-care documents exchanged between health systems. Its defining idea is the two-layer body: a <text> narrative block that a clinician reads and that is legally authoritative, and coded <entry> elements carrying the same information as structured data for a machine.

Those two layers must agree, and nothing in the schema makes them. A coded entry asserting a medication the narrative does not mention is schema-valid and clinically wrong, which is why CDA implementation guides ship Schematron rules alongside the XSD and why conformance is tested against both.

Constraints that bite

  • The narrative block is authoritative. Coded entries that contradict it are a patient-safety defect, not a validation error.
  • templateId values declare which implementation guide the document claims to follow, and the guide's rules are Schematron rather than schema.
  • Coded values carry a codeSystem OID; the same code means different things under different systems, so the pair is the identifier.
  • Dates use HL7 v3 TS format (YYYYMMDDHHMMSS±ZZZZ), not ISO 8601, and a truncated date is legitimately less precise rather than invalid.
  • Documents carry patient identifiers by definition; treat every CDA file as regulated personal data at rest and in logs.
Root element
<ClinicalDocument>
Media type
application/xml
Extensions
.xml, .cda
Namespaces
  • urn:hl7-org:v3
XMLDir label

Specification: HL7 CDA Release 2

A minimal valid document

Every example on this site is checked against the same parser the workspace uses, so what you see below is known to be well-formed.

hl7-cda.xml
<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3">
  <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
  <templateId root="2.16.840.1.113883.10.20.22.1.2"/>
  <id root="2.16.840.1.113883.19.5" extension="DOC-0001"/>
  <code code="34133-9" codeSystem="2.16.840.1.113883.6.1"
        displayName="Summarization of Episode Note"/>
  <effectiveTime value="20260115093000+0000"/>
  <recordTarget>
    <patientRole>
      <id root="2.16.840.1.113883.19.5" extension="P-0001"/>
    </patientRole>
  </recordTarget>
  <component>
    <structuredBody>
      <component>
        <section>
          <code code="10160-0" codeSystem="2.16.840.1.113883.6.1"/>
          <title>Medications</title>
          <text>No current medications.</text>
        </section>
      </component>
    </structuredBody>
  </component>
</ClinicalDocument>

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.