Generic types like DV_INTERVAL<DV_DATE_TIME>
have inconsistently converted <...>
for the generic part. Only the <
is converted to <
. The ending >
is not encoded to >
.
In CKM on “OPT” tab:
<rm_type_name>DV_INTERVAL<DV_DATE_TIME></rm_type_name>
OPT downloaded from CKM “Export Template” tab:
<rm_type_name>DV_INTERVAL<DV_DATE_TIME></rm_type_name>
Notice that the ending >
is not converted to >
.
Examples (search for DV_INTERVAL
):
In the OPT Tab, <
is rendered as < by the browser.
This is the same if I just type it in discourse, it will be rendered as < if I don’t use preformatted text.
If you copy or download and view in a text editor it will show you the <
as you have noted. However if you open the exact same document in a browser etc. e.g. with an xml extension instead of opt it will also render it as >. Probably most xml editors would behave similarly and make this transparent to the user.
< must be escaped in text within an xml document, whereas for > this is not required (within text) as far as I know. So this is what we are doing. We could make it more ugly by using >
but this is not a requirement as far as I know.
1 Like
I would prefer ugly but consistent (<...>
)
But as you say the current variant is a valid XML
I have updated my XML parser to handle the current format. Thank you for explaining that this is the expected output in OPT files.
I did some more research
When the same OPT is exported from the Archetype Designer, it encodes both <
and >
.
When the archetype with DV_INTERVAL<DV_DATE_TIME>
(https://ckm.openehr.org/ckm/archetypes/1013.1.614/export) is exported from CKM as XML, it also encodes both <
and >
.
Only export to OPT from CKM leaves the >
unencoded.
In my understanding both are correct, any xml parser should deal with this transparently?
@sebastian.garde I’m not saying it is a bug As you mentioned, it is a valid XML.
I first stumbled on this with CKM OPTs but wanted to document it in case others stumble on the same thing. It took me some time debugging my code before I noticed that >
is part of DV_INTERVAL
:
<rm_type_name>DV_INTERVAL<DV_DATE_TIME></rm_type_name>
However it would be interesting to check the code used to export archetypes to XML and the one that exports to OPT. I would expect the same code to be used for rm_type_name