# BR-KSA-27

Source: https://xmlvalid.com/rules/BR-KSA-27

> The document must contain a QR code (KSA-14), and this code must be base64Binary.

- Level: warning
- Rule sets: ZATCA e-invoicing rules (Saudi Arabia) SDK 3.4.6
- Context: `/ubl:Invoice | /cn:CreditNote`
- Test: `(cac:AdditionalDocumentReference[normalize-space(cbc:ID) = 'QR'] and exists(cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject) and (cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject) != '' and (cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject[normalize-space(@mimeCode) = 'text/plain']))`

Validate a document against these rules: https://xmlvalid.com/validate
