Skip to content

Validate rendering-xhtml extension contents using FHIR XHTML rules#653

Merged
andrzejskowronski merged 1 commit into
developfrom
copilot/validate-rendering-xhtml-extension
Mar 27, 2026
Merged

Validate rendering-xhtml extension contents using FHIR XHTML rules#653
andrzejskowronski merged 1 commit into
developfrom
copilot/validate-rendering-xhtml-extension

Conversation

Copilot AI commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

The rendering-xhtml extension (http://hl7.org/fhir/StructureDefinition/rendering-xhtml) stores XHTML in a valueString, bypassing the type system's XHTML validation. The validator treated it as plain text, missing invalid XHTML such as disallowed <script> tags.

Changes

  • RenderingXhtmlValidator (new) — IValidatable that navigates to the value[x] child of an Extension, and if it's a FhirString, calls XHtml.IsValidNarrativeXhtml — the same method used by FhirTxt1Validator for Narrative.div. Reports XSD_VALIDATION_ERROR issues consistent with existing XHTML validation output.

  • ExtensionSchema.ValidateInternal — After normal extension validation for each URL group, adds a rendering-xhtml URL check that runs RenderingXhtmlValidator on each instance. Fires regardless of whether the extension schema resolves.

  • PublicAPI.Unshipped.txt — Declares the new public API symbols.

Testing

Three new facts in ExtensionSchemaValidationTests:

  • RenderingXhtmlExtension_WithValidXhtml_PassesValidation — valid XHTML produces no errors
  • RenderingXhtmlExtension_WithInvalidXhtml_FailsValidation<script> tag produces XHTML validation errors
  • OtherStringExtension_WithXhtmlLikeContent_IsNotValidatedAsXhtml — arbitrary string extensions are unaffected

@alexzautke

Copy link
Copy Markdown
Member

Fixes #569

@andrzejskowronski
andrzejskowronski merged commit 74d555b into develop Mar 27, 2026
2 checks passed
@andrzejskowronski
andrzejskowronski deleted the copilot/validate-rendering-xhtml-extension branch March 27, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants