Android 使用 retrofit2 解析XML响应

处理JSON使用 converter-gson,一下子来个XML,搜索依赖发现有个 converter-simplexml,IDE提示 converter-simplexml 已经过时,然后改用 converter-jaxb,后来到github看文档才知道 converter-jaxb 在 Android 上用不了,simplexml 又提示不支持XML1.1,再一看文档,Android上使用 simplexml 要去除几个依赖,然后就搞定了,kts配置如下:

    implementation("com.squareup.retrofit2:converter-simplexml:2.9.0") {
        exclude( module= "stax")
        exclude (module= "stax-api")
        exclude (module = "xpp3")
    }

groovy配置如下:

implementation('com.squareup.retrofit2:converter-simplexml:2.9.0') {
    exclude module: 'stax'
    exclude module: 'stax-api'
    exclude module: 'xpp3'
}

最后附上几个参考链接:

Simple XML Converter

Parsing XML using Retrofit2 in Kotlin 

相关推荐

  1. Android 使用 retrofit2 解析XML响应

    2024-01-04 14:04:02       61 阅读
  2. Android retrofit使用模板

    2024-01-04 14:04:02       148 阅读
  3. Android retrofit

    2024-01-04 14:04:02       28 阅读
  4. AndroidRetrofit的学习和使用记录

    2024-01-04 14:04:02       26 阅读
  5. 使用Python的xml.etree.ElementTree模块解析XML文件

    2024-01-04 14:04:02       30 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-04 14:04:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-04 14:04:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-04 14:04:02       82 阅读
  4. Python语言-面向对象

    2024-01-04 14:04:02       91 阅读

热门阅读

  1. uView Form 表单

    2024-01-04 14:04:02       58 阅读
  2. 15.bash shell中自定义命令行选项与getopt/getopts

    2024-01-04 14:04:02       58 阅读
  3. Linux软链接的创建,删除,修改

    2024-01-04 14:04:02       61 阅读
  4. Mysql数据库:select from语句详解

    2024-01-04 14:04:02       53 阅读
  5. oj 1.9编程基础之顺序查找 06:笨小猴

    2024-01-04 14:04:02       59 阅读
  6. html引入ECharts的两种方式

    2024-01-04 14:04:02       61 阅读
  7. Linux系统启动时汇编指令

    2024-01-04 14:04:02       60 阅读
  8. 安全防御之身份鉴别技术

    2024-01-04 14:04:02       55 阅读
  9. 修改 Ubuntu 的配置

    2024-01-04 14:04:02       59 阅读
  10. Graphical Integtrity;lie factor;data-ink ratio

    2024-01-04 14:04:02       59 阅读
  11. nodejs中ffcreator启动

    2024-01-04 14:04:02       53 阅读