Using XMLBeans on Android

By : Robbie
Source: Stackoverflow.com
Question!

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

By : Robbie


Answers

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

By : SMac




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.



This video can help you solving your question :)
By: admin