Is there a need in JAXB implementation for Android

2019-01-20 03:38发布

As far as I know, there is currently no JAXB implementation which would work on the Android platform.

I would like to ask a simple question - Is there a need for JAXB on Android?

Being a JAXB enthusiast, I consider writing a JAXB implementation for Android. I probably won't port JAXB RI since it is a bit too fat for the mobile apps, I'd rather write it from scratch. I wrote a JAXB port for JavaScript, so I know this is manageable.

But do you guys need it? Or do are you comfortable with other tools like SimpleXML?

5条回答
爷、活的狠高调
2楼-- · 2019-01-20 04:19

The JAXB reference implementation requires around 3.5MB of space, and uses features that are missing from Android. An Android-compatible implementation will therefore be larger because it will need to supply implementations of those features additionally.

Plenty of Android phones ship with 40MB or less of free space on their internal storage. And that's OEM versions, before networks have "customized" them by adding extra applications and free trials that can't be uninstalled. As long as you want people who have these phones install your application, therefore, you do not want to make it that large. And most app developers want their apps to be as widely usable as possible. It therefore seems to me that the number of people interested in an implementation of a library that large for Android will be very limited.

查看更多
\"骚年 ilove
3楼-- · 2019-01-20 04:22

JAXB appears to almost be a thing on Android. At least, if the contents of this question thread are to be believed.

It seems to be in high demand because the Dalvik VM can't support the components of JAXB that rely on reflection. So, perhaps there is a use for this after all. :)

查看更多
Evening l夕情丶
4楼-- · 2019-01-20 04:26

lexicore there is a need for JAXB on android, SimpleXML is great and I prefer it to JAXB in some ways, however JAXB is a standard and is widely used.

A useful example that would be really great is if an Android app could share a jar full of JAXB POJO's with an EE app and use these with RESTful calls to the EE app.

查看更多
等我变得足够好
5楼-- · 2019-01-20 04:36

As it turns out, JAXB is not natively supported by Android. An alternative would be to include the library and using it, but that would incur a lot of wasted resources (the JAXB library is pretty big).

In a quick search, IBM Developerworks revealed an interesting article. I skimmed though the document. I don't think the library is as powerful or as versatile as JAXB, but it should fit the bill for most intents and purposes. Moreover, it is natively supported by Android, therefore should be reasonably efficient.

The link to the document is: http://www.ibm.com/developerworks/opensource/library/x-android/

There is another library which comes highly recommended by many. The SF link is: http://sourceforge.net/projects/simple/ The zip package weighs only 2.5M, which means that its pretty light weight.

查看更多
欢心
6楼-- · 2019-01-20 04:38

As an Android developer who does lot of XML and JSON parsing and framing in almost every app I develop, my answer would be: No, there is no need for JAXB on Android. The other tools fit the bill perfectly. Either that, or we Android developers have got used to the absence of JAXB and each of us have gotten comfortable with one of the alternatives.

In my case, I even achieve code reuse by replacing JAXB with my favorite Android XML serialization library on the server as well.

查看更多
登录 后发表回答