# Which implementations of openEHR can serialize to/deserialize from published XSD compatible XML? **Category:** [Implementers (archive)](https://discourse.openehr.org/c/implementers-archive/158) **Created:** 2012-03-17 17:10 UTC **Views:** 1 **Replies:** 11 **URL:** https://discourse.openehr.org/t/which-implementations-of-openehr-can-serialize-to-deserialize-from-published-xsd-compatible-xml/14062 --- ## Post #1 by @Seref Greetings, The subject says it all actually: which open source implementations out there are capable talking to XML that is compatible with the published schema? openEHR.NET on Codeplex is one. There is relevant code in Rong's codebase, but I'm not sure if it is valid according to published schemas. Do you know any other codebase that can do this? Best regards Seref --- ## Post #2 by @system > Greetings, > The subject says it all actually: which open source implementations out > there are capable talking to XML that is compatible with the published > schema? > openEHR\.NET on Codeplex is one\. There is relevant code in Rong's codebase, > but I'm not sure if it is valid according to published schemas\. My kernel can and is more or less compatible, but it is not open source\. I use it to create RM\-objects for internal use\. \(i\.e\. validation\) It is not that hard to build\. JAXB en some modifications in the RM, and you are half way\. My tip: Buy a book about JAXB, read it, and you have your XML\-RM\-kernel in less then two weeks or a month\. Maybe even faster than implementing someone else work\. Must be a piece of cake, certainly for you, Seref, I have looked at your other work in the recent past, it is very good\. --- ## Post #3 by @Seref Hi Bert, Thanks for the response. I wanted to know how others are dealing with a mismatch that exists: the XSD for openEHR and the actual specification that uses features that does not exist in XSD. I have been looking at the idea of connecting Rong's code base to JAXB, and some cases become quite difficult. I was wondering if others have dealt with similar problems. I find the idea of seperating JAXB generated classes and actual RM implementation quite interesting, but it is not quite straightforward, mainly because of java generics. In java, I am very much in favour of using JAXB for openEHR as a separate layer, and letting RM implementations use that layer in a loose coupled way. I guess putting that functionality into RM classes would help, but you'd still have to deal with generics related issues if you use them. (there are ways, but quite tricky) I assume you've used XSD and JAXB as a starting point in building your kernel, right? Kind regards Seref --- ## Post #4 by @system Hi Seref, It is more then a year ago I implemented JAXB, I remember, there were some hard issues, I forgot which and how I solved them or ignored them\. I remember there was one at DV\_INTERVAL, I don have access to my code now, I check it later\. Bert --- ## Post #5 by @system Hi\! In LiU EEE we are using the Java <\-> XML stuff for RM instances in Rong's codebase \(java\-ref\-impl\) during validation\. I have not checked if it is 100% valid according to the specified schema but since the XML end of things in Rong's code is autogenerated from the schema I'd guess it is fairly compliant\. Some improvements were made and committed last year if I remember correctly Best regards, Erik Sundvall erik\.sundvall@liu\.se http://www.imt.liu.se/~erisu/ Tel: \+46\-13\-286733 --- ## Post #6 by @Seref I've checked to be sure. Rong's code is using XMLBeans, and the XML it generates seems to validate against 1.0.1 XSD. I've used a test composition instance I've created by hand. He is using a smart bit of code and reflection, but he is avoiding the issue I've faced with generics by using the return values of parameterized methods. His mapping code would probably work with JAXB with minor tweaking, looking at the way it works. I've tried something (that became kinda science fiction in the process) to do the same think his code is doing, but I may resort to his way of doing it for the moment. Rong, if you're reading this, I should really buy you a serious amount of your favorite drinks at one point. Kind regards Seref --- ## Post #7 by @system I checked it, my JAXB implementation works, also on generics, but it is not fully compatible with the XSD\-specification\. I never saw that as a problem, but it will be if I interchange XML's \(which I do not now\)\. So I take a look at the tip from Eric Sundvall and the work of Rong Chen Thanks for bringing it up Bert --- ## Post #8 by @yampeku Are we talking about archetype instances or data instances? --- ## Post #9 by @Seref I am talking about everything that is covered by XSDs; so both AOM and RM are included, though I'm more interested in RM these days. Saving objects to XML and loading them again is not a problem, but if the XML output is not compatible with published schema, this does not only break interoperability across systems, it also breaks integration of various tools. If I release a back end that will work with say Pablo's UI layer, XML is the only technology I can rely on to get data into my back end, and get it out from it. Same goes for modelling tools, etc etc. There is a slowly emerging pattern here, where different groups are getting ahead in various components compared to each other, and even if there is a good tendency to open source /share our work, how can we use each other's work if we don't have a shared inter-technology data format? --- ## Post #10 by @yampeku In LinkEHR we use one \(old\) version of the XML serializer and recently I implemented a XML parser from an improved version of the AOM schema \(trying to be able to represent and parse the same things that the ADL parser can\)\. Maybe I should post the schema so anyone can review and improve it\. --- ## Post #11 by @system > His mapping code would probably work with JAXB with minor tweaking, looking > at the way it works\. I've tried something \(that became kinda science fiction > in the process\) to do the same think his code is doing, but I may resort to > his way of doing it for the moment\. > > Rong, if you're reading this, I should really buy you a serious amount of > your favorite drinks at one point\. > Thx, Seref\! Look forward to that one =\) Seriously, I would be very interested in the JAXB version of the xml binding component\. Cheers, Rong --- ## Post #12 by @Seref It is in the works, but I've tried to eliminate reflection from the implementation and that made things a bit complicated :) --- **Canonical:** https://discourse.openehr.org/t/which-implementations-of-openehr-can-serialize-to-deserialize-from-published-xsd-compatible-xml/14062 **Original content:** https://discourse.openehr.org/t/which-implementations-of-openehr-can-serialize-to-deserialize-from-published-xsd-compatible-xml/14062