I’m writing an API client library for Android and I’ve used Simple XML to deserialize the objects since it seems JAXB doesn’t work on Android.
The classes in the API project have XML annotations for JAXB. I copied the classes to my Android library but changed the XML annotations for Simple XML. Obviously, this will create a problem syncing changes.
Is there anyway to make the two compatible so that the same code can be used with JAXB and Simple XML?
The only solution I see as possible is using both annotation types at the same time. You can mark each member field with JAXB and SimpleXML annotations. Of course you need some glue to get this working and make the compiler not complain about inexistent annotations. To get rid of this you can write your own annotation library implementing the missing annotations in every case (JAXB annotations on Android and SimpleXML on other projects) doing what is expected (nothing).