Special Application Requirements

Your Android application will need to set properties and classloaders in order to get the factories used by the Android support code to work. Here is the relevant code from the AndroidRSS sample (see RSSReader.java):

            //In order for the factory finder to locate the factories provided
            //by soxp.jar and j2se_android.jar, you need to set the following
            //system properties.
            System.setProperty("javax.xml.stream.XMLOutputFactory", 
            "com.objsys.soxp.XMLOutputFactory");
            System.setProperty("javax.xml.stream.XMLInputFactory",
            "com.objsys.soxp.XMLInputFactory");
            System.setProperty("javax.xml.DatatypeFactory", 
            "com.objsys.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl");
            
            
            /* It is common for factory finders to use Thread.getContextClassLoader
            * in order to get the correct class loader for loading the factory.  
            * Here, we set the context class loader to the application's class 
            * loader. 
            */
            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());