Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using XMLBeans on Android

I was just wondering if anyone had any success in getting XMLBeans (or any other generator) to work on android. It would be very nice if I could use it because I have a very large schema that I would rather not write all the classes by hand.

I had asked about this on the android developers mailing list, but no one responded. This tells me that either they don't care, or no one feels like telling me its not possible.

If anyone knows of anything else like XMLBeans that works for android, please let me know. It would be very helpful.

Thanks, Robbie

like image 813
Robbie Avatar asked Jul 14 '09 15:07

Robbie


3 Answers

If you're looking to do class generation and DOM parsing, XMLBeans is probably pretty heavy-weight for a mobile device running android. All of the code generated by XMLBeans makes synchronized calls into an underlying data store that I've seen as a hot spot several times when profiling.

I can't suggest any alternatives, but I would be wary of using this even if you could get it to work, because of the afore mentioned performance issue.

like image 117
Paul Morie Avatar answered Sep 23 '22 06:09

Paul Morie


You can use Castor . Just be sure, in Android 2.1, not to use default android SAXParser. You'll get namespace errors. You do this by defining the parser to be, for example, Xerces (and the you add the required JARS), in core.properties . In android 2.2 it may be ok. Note that if you create an xmlcontext for the unmarsheler with xerces, it still won't work, as the mapping itself would be parsed with android's SAX. It must be done at core (top level properties file) so that even the mapping is parsed by xerces. finally - performance is as slow as you can expect... :( Good luck SM

like image 37
SMac Avatar answered Sep 22 '22 06:09

SMac


I got JAXB working on Android.

like image 44
JasonPlutext Avatar answered Sep 22 '22 06:09

JasonPlutext