On 09/02/2013 11:11 AM, Birger Haarbrandt wrote:
> Then, the document gets validated with help of the XSD and gets stored 
> persistently into a XML Database
Hi Birger,

This will only work if the templates does not need to be validated done 
against the underlying archetypes and reference model.
So to speak, if the templates and its data are treated as a list of 
paths and values with no reference to any underlying model. Maybe, for 
certain kind of datamining, this will do.

If this is your plan, why would you, in that case, need XML Schema? 
Because, what are you validating then?
----------------
But if this is not the case, consider next:

If ADL had the same characteristics as XML Schema (1.1), then we would 
not have needed ADL. We would simply have written our archetypes in XML 
Schema (1.1). But this is not the case. We need ADL.

There are the XSD's representing the Reference Model. You can use them 
to validate on that level. You can, I think, validate that an XML 
represents an instance which validates well against the Reference Model. 
But there it stops.

But you cannot specialize XSD's in the same way you specialize the 
Reference Model to archetypes. This is because extension and restriction 
have another meaning in the XML Schema then in the reference model. You 
will run into conflicts. So you cannot check if a derived XSD is valid 
against the top XSD. Every archetype must be represented by a 
stand-alone XSD.

But also you will run against another problem:

The other problem is that XML Schema does not allow siblings having the 
same name, but are of different type. This happens all the time in 
archetypes, for example, an item-list has elements and one element has a 
dv_text as value, the other a dv_boolean. The XML Schema-parsers (from 
Saxony and also Apache) see them as different types. So the item-list 
mostly cannot have children called "element". You can solve that by 
name-mangling to get a valid XSD. I would not advise this route.

More people have run into these problems. One has solved by giving every 
element another name, with a GUID in it. It has become a completely new 
Reference Model. You can find it when you search MLHIM.
I do not comment on this solution to avoid an old discussion.

It is also possible to validate XML representing rm-objects by RelaxNG 
together with Schematron. But you have to write an engine which 
translates ADL to these schema-languages. This is a bit hard, writing 
that engine, but still I think this is the best way, and there 
complexities which you may not realize now. For example, how do you 
validate documents having archetypeslots in it?
----------

I saw other people are offering help too, maybe your project can be 
arranged in a way that you will not run into problems.
Good luck.

Bert




-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.openehr.org/pipermail/openehr-technical_lists.openehr.org/attachments/20130902/7a3c7104/attachment.html>

Reply via email to