Search code examples
javaandroidsimple-framework

How to use and modify the source code from simplexml library in Android?


I just downloaded the soucre code from the library simplexml http://simple.sourceforge.net/download.php

I want to make a few modifications in the source code and use it in android, enter image description here

Unfortunatly there are two classes StreamProvider, and StreamReader, that need an external reference, The original project provide this libraries

enter image description here

trying to use this libraries in the android project you get compilations errors.

How to modifiy the source code from this library and use in Android?

I want to use the source of this library directly, and be able to modify, not just use it with gradle or a jar file.

enter image description here


Solution

  • You can delete StreamProvider.java and StreamReader.java clases, this classes are not compatible with Android

    And you have to choose a xml-provider

    enter image description here

    And in ProviderFactory.java use PullProvider or Document Provider

    enter image description here

     public static Provider getInstance() {
      /*
      try {
         try {
            return new StreamProvider();
         } catch(Throwable e) {
            return new PullProvider();
         }
      } catch(Throwable e) {
         return new DocumentProvider();
      }
      */
      try {
         return new PullProvider();
      } catch (Exception e) {
         e.printStackTrace();
      }
      return new DocumentProvider();
     }