0

我的 Android 应用程序将使用 XML 与 Spring Boot REST 服务进行通信。

JAXB 对于 Android 来说并不容易(或重量轻)。因此,我阅读了有关使用 jackson-dataformat-xml 的信息。我使用(嵌套)对象列表。

我的问题:这是(取消)编组 XML 消息的首选方式吗?如果没有,Android 有什么好的选择?如果是这样,您能帮助解决以下问题吗?

JUnit 测试很容易通过。编译可以使用:

packagingOptions {
    pickFirst  'META-INF/license.txt'
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/MANIFEST.MF'
    exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
    exclude 'META-INF/services/com.fasterxml.jackson.core.ObjectCodec'
}

dependencies { 
    .... 
    compile 'com.fasterxml.jackson.core:jackson-core:2.1.2'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.1.2'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.1.2'
    compile( 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.3.0')
}

无法运行应用程序。我得到各种各样的错误,比如这些:

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.codehaus.stax2.XMLStreamLocation2$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.

编辑: 与此同时,我看到 Simple XML 得到了很好的评价。

4

1 回答 1

0

我现在正在使用简单的 XML。这工作正常。

于 2017-02-24T07:50:03.793 回答