Stream: implementers
Topic: Publisher or fhir-xhtml.xsd issue with .text.div XML attrs
Shahim Essaid (Nov 15 2020 at 00:14):
It appears that the fhir-xhtml.xsd schema doesn't allow the following attributes on .text.div, or at least the publisher doesn't accept them and adds an error in the QA.
<text>
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml http://hl7.org/fhir/R4/fhir-xhtml.xsd">
...
The publisher generates the following error:
txt-1: The narrative SHALL contain only the basic html formatting elements and attributes described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, <a> elements (either name or href), images and internally contained style attributes [htmlChecks()]
Removing those attributes fixes the issue but having them is useful since they allow a XML editor perform correct auto-completion and validation. The Eclipse XML editor, for example, recognizes the schema and doesn't have an issue with these attributes but the publisher flags them as invalid.
Lloyd McKenzie (Nov 15 2020 at 01:20):
There's an explicit declaration in the spec that schema declarations aren't permitted in exchanged instances - pointing to a schema is a security risk.
Shahim Essaid (Nov 15 2020 at 02:01):
@Lloyd McKenzie I wasn't aware of that part of the spec. Thanks! At the moment I do have XML schema declarations on all resources (structures and their examples) in my IG content but the .text.div ones are the only ones being flagged with errors in the QA.
I might be able to add the schema info to my IDE to avoid having it in the files themselves. Not sure if the IDE will allow me to specify this for the .text.div content if the different namespace is implied in the FHIR tooling and I won't be able to use a different namespace like "fhirhtml:".
Not a real issue. I just thought this is something that can be addressed by the publisher. Maybe add this as a configuration option for the IG to try to keep the QA report cleaner if a user chooses to bypass that check?
Lloyd McKenzie (Nov 15 2020 at 02:06):
The publisher strips out schema declarations on the root - because we do use them when authoring instances. It's not set up to strip declarations inside the instance though.
Shahim Essaid (Nov 15 2020 at 02:25):
Good to know. So if validation is applied to the built version, it sounds like stripping out this content for .text.div, or any other ones, might be an option? Also, is it the location that is the problem, or is it that i also can't configure the namespace prefix mappings?
Lloyd McKenzie (Nov 15 2020 at 03:15):
There should be no need to declare a schema on anything other than the root. You need to declare the namespace on the div, but no need for a schema declaration
Last updated: Apr 12 2022 at 19:14 UTC