Can't use XMLGregorianCalendar in Android, even if it's documented?

I really don't get it: Android seems to have an XMLGregorianCalendar class because it is documented here . But if you continue and try to use it, then 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 as described on the official Android Javadoc .

It looks like one of the not-so-smart things about Android. Why do you need to document something that cannot be used? Does anyone have a solution on this that might not include repacking?

+4
source share
1 answer

It appears that although in the v8 API no version of Android has ever shipped with the implementation . Convenient, right?

One solution is to download the Xerces2 Java implementation and incorporate it into your project building path.

Your code will be slightly different:

 DatatypeFactory datatype = DatatypeFactoryImpl.newInstance(); 
+6
source

All Articles