简体   繁体   中英

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, 在此处输入图片说明

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

在此处输入图片说明

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.

在此处输入图片说明

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

And you have to choose a xml-provider

在此处输入图片说明

And in ProviderFactory.java use PullProvider or Document Provider

在此处输入图片说明

 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();
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM