Stream: implementers
Topic: storing html code
Naminder Soorma (Jul 06 2016 at 15:22):
Is it possible to store html code/markdown code in say description elements?
Lloyd McKenzie (Jul 06 2016 at 16:19):
There's an extension for that :> http://www.hl7.org/fhir/extension-markup.html
Lloyd McKenzie (Jul 06 2016 at 16:19):
Also, for StructureDefinition and a few other resources, some of the elements are already defined as Markdown
Naminder Soorma (Jul 07 2016 at 08:31):
edit - will this only work for StructureDefinition?
I am wanted a field in the CodeSystem resource that allows me to attached HTML from a code system description, is this achievable?
So a very rough example would be shown near the bottom of this code:
<CodeSystem xmlns="http://hl7.org/fhir">
<url value="http://fhir.nhs.net/CodeSystem/TestCodeSystem"/>
<identifier>
<system value="http://fhir.nhs.net/TestCodeSystem"/>
<value value="CodeSystemNHS"/>
</identifier>
<version value="1"/>
<name value="CodeSystemNHS"/>
<status value="active"/>
<experimental value="false"/>
<date value="2016-07-05"/>
<description value="Test CodeSystem"/>
<extension xmlns="http://hl7.org/fhir"
url="http://hl7.org/fhir/StructureDefinition/codesystem-comments" >
<valueString value="Notes at the bottom comments can be entered here"/>
</extension>
<extension xmlns="http://hl7.org/fhir"
url="http://hl7.org/fhir/StructureDefinition/markup" >
<valueString value="<html><body><p id="demo"></p>"/>
</extension>
<caseSensitive value="false"/>
Lloyd McKenzie (Jul 07 2016 at 14:01):
You'll have to escape the HTML, so <valueString value="<html><body>..."
Also, your html would need to be valid - so close tags for every open tag. In this case you should strip the <html> and <body>. I'd expect something like <valueString value="<b>This is an <i>important</i> description</b>"/>
Naminder Soorma (Jul 07 2016 at 14:30):
ok, the server seems to have accepted it, but got to admit seems a very messy way to have to escape the HTML tags. Then on output would have to re-enter them...
Eric Haas (Jul 07 2016 at 14:52):
Are you asking wherther to have this in the narrative part of the resource or in the description element itself?
Lloyd McKenzie (Jul 07 2016 at 16:09):
@Naminder Soorma The HTML content is just a string. So long as you treat it as a string, your XML handler should deal with the escaping and unescaping transparently for you. (The alternative would be to base-64 encode it, which would be worse . . .)
Naminder Soorma (Jul 08 2016 at 08:20):
@Lloyd McKenzie - ok I understand now that it is simply a string, I will play with getting our data into the format needed. @Eric Haas - I am trying to have it as a description element. For example I have data held in a table and want to store the header row retaining the bold text to distinguish it from the data values
Naminder Soorma (Jul 08 2016 at 09:53):
Thanks got this sorted now, this website helped to get all the codes https://dev.w3.org/html5/html-author/charref
<extension xmlns="http://hl7.org/fhir" url="http://hl7.org/fhir/codeSystem/markup" >
<valueString value="<table border="1"><tr><td><b>Line 1 Header</b></td></tr><tr><td>Line 2 Data</td></tr></table><br /><b>This is an <i>important</i> description</b>"/>
</extension>
Last updated: Apr 12 2022 at 19:14 UTC