<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKCDADocumentSample",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKCDADocumentSample"
  },
  "title" : "HKCDADocumentSample"
}
-->

# HKCDADocumentSample

A Clinical Document Architecture (CDA) sample that stores a single document.

```
class HKCDADocumentSample
```

## Overview

The sample’s `document` property contains an [`HKCDADocument`](/documentation/HealthKit/HKCDADocument) object, representing the underlying XML document.

The [`HKCDADocumentSample`](/documentation/HealthKit/HKCDADocumentSample) class is a concrete subclass of the [`HKDocumentSample`](/documentation/HealthKit/HKDocumentSample) class. Document samples are immutable. HealthKit assigns the document’s properties when the sample is created. They cannot change. If you need to update a document in HealthKit, create a new document sample with the updated CDA document.

## Topics

### Creating CDA Samples

[`init(data:start:end:metadata:)`](/documentation/HealthKit/HKCDADocumentSample/init(data:start:end:metadata:))

Returns a CDA document sample containing the provided XML document and metadata.

[`HKDetailedCDAValidationErrorKey`](/documentation/HealthKit/HKDetailedCDAValidationErrorKey)

A key for accessing validation error information from an error object’s user information dictionary.

### Accessing the Document

[`document`](/documentation/HealthKit/HKCDADocumentSample/document)

The CDA document.

[`HKCDADocument`](/documentation/HealthKit/HKCDADocument)

An object representing a Clinical Document Architecture (CDA) document in HealthKit.

### Accessing Validation Errors

[`HKDetailedCDAValidationErrorKey`](/documentation/HealthKit/HKDetailedCDAValidationErrorKey)

A key for accessing validation error information from an error object’s user information dictionary.

### Specifying Predicate Key Paths

[`HKPredicateKeyPathCDAAuthorName`](/documentation/HealthKit/HKPredicateKeyPathCDAAuthorName)

The key path for accessing the author’s name inside a predicate format string.

[`HKPredicateKeyPathCDACustodianName`](/documentation/HealthKit/HKPredicateKeyPathCDACustodianName)

The key path for accessing the custodian’s name inside a predicate format string.

[`HKPredicateKeyPathCDAPatientName`](/documentation/HealthKit/HKPredicateKeyPathCDAPatientName)

The key path for accessing the patient’s name inside a predicate format string.

[`HKPredicateKeyPathCDATitle`](/documentation/HealthKit/HKPredicateKeyPathCDATitle)

The key path for accessing the document’s title inside a predicate format string.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)