And get a TemplateDocument which is a generated class from the XSD and the XML.
Looking at the structure of the class I found that many classes have the same name as the ones from the classes that represent C_COMPLEX_OBJECT, C_SINGLE_ATTRIBUTE, etc… from the package org.openehr.am.
I think I need is a “how to” on how we are supposed to work with the java libs.
I understand that code and test module are the official documentations of the java-libs but I think this increases the entering difficulty level.
There is no how to or workflow on how to do stuff with the library.
Most of the test functions on the test module are Unit testing and don’t show how the different modules interact with each other.
A simple workflow would be to load the Oet and the adl from the archetypes, create an OPT structure and output a XML file of that structure.
How can I do this using this library? Is it Possible? What’s missing?
I don’t think that is a logic answer to tell me to use the Ocean Template Designer converter to convert from a OET to a OPT. The answer I was looking was: “Yes the java libs can do the conversion look at this code” or “No, the java-libs doesn’t do it and you are free to implement it and ask for a pull request on github”.
Don’t get me wrong I just think that the philosophy of “I had a tough time writing it why should I make it easier with documentation” or “ the new guy has to pay the due like I did” is not a good way to build an open source community.
Regarding the class TemplateDocument you have two classes with similar names:
—openEHR.v1.template.TemplateDocument which parses a OET structure and is a derivation of the archetype class in openEHR.am;
—org.openehr.schemas.v1.TemplateDocument which parses OPT structures and that has the same class names as the previous one but are on different packages and you cannot use the functions you would use on archetypes and OET in this object. Although they are basically the same thing their classes are different.
NP, I know is tough, though I didn’t write the code : D and I had the same experience you are having now, and did the same thing some years ago: looked at the code and execute it.
If you find any discrepancies between names, or improvements that can be done, please create an issue on GitHub. Also, contributions are welcome! If you fix an issue, just send the PR, the repo owners will accept the fixes.