I really can't understand this one: it looks like Android has the XMLGregorianCalendar class, because it is documented here. But if you go ahead and try to use it, that's what you get:
10-27 17:21:43.677: E/AndroidRuntime(14850): Caused by: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found
10-27 17:21:43.677: E/AndroidRuntime(14850): at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:102)
This happens on the line:
DatatypeFactory datatype = DatatypeFactory.newInstance();
And guess what, it should not behave like this, as documented on the official Android Javadoc.
This looks like one of the not-so-smart things about Android. Why would you document something that can't be used? Does anyone have a solution on this, one that maybe does not include repackaging?
It looks like even though it's been in the API since v8, no version of Android has ever shipped with an implementation. Handy, right?
One solution is to download the Xerces2 Java implementation jar and include it on your project's build path.
Your code would be only slightly different:
DatatypeFactory datatype = DatatypeFactoryImpl.newInstance();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With