My goal is to make XML binding in javascript. Although this is uncommon, I need this for a Thunderbird plugin. I wish to make in javascript (XPCOM has no longer java support). So this isn't for serializing and using JSON. I really need XML manipulation in Javascript. I don't mind if the scripts are heavily sized.
Ideally, I want to reuse java code (because I've got a lot of java code done and also because I have no clue of JS :s ). So I have been looking on how to deal with this in GWT with JAXB : GWT and a jaxb objects
Unfortunately, the gwtjaxb project seems to only deal with marshalling and I need both, Marshalling and Unmarshalling, in gwt client code. Am I wrong?
I've also considered Pitiri: GWT XML (xml-object-mapping)
And also using Errai in gwt to map to JSON and then with Jsonix (via JSNI) from JSON to XML and vice versa: Is there a JavaScript API for XML binding - analog to JAXB for Java?
POJO <=> JSON <=> XML
But this seems tedious.
Does someone have any experience or clue on this?
Thanks!
Author of Jsonix here. I'll just address the question if Jsonix is of help here or not.
Jsonix suits the JSON <=> XML task, it's neatly bidirectional and has nice features of being type and structure-strict.
But you need mappings to make the conversions. This is normally not a big deal if you have and XML Schema to start with. If you don't, you'd have to write them manually which can be somewhat problematic. At the moment, there's no way to generate these mappings from Java code (as I understand this is what you need). It would be possible to implement (and not problematic at all), but it just isn't there at the moment.
By the way, do you need POJO <=> JSON <=> XML
or would POJO <=> JSON
plus POJO <=> XML
work as well? I think the latter should be possible with JAXB/Jackson combo.