【问题标题】:Read XML from R.xml and not as an XMLPullParser从 R.xml 读取 XML,而不是作为 XMLPullParser
【发布时间】:2015-04-22 18:39:49
【问题描述】:

我想将我的 xmls 从我的 R.xml 目录传递到 Simple 库以进行反序列化。

图书馆接受ReadersInputSreams 等。

但是从R.xml 我得到XMLPullParser。我怎样才能得到类似 ReaderInputStream 的东西?

【问题讨论】:

    标签: android xml parsing


    【解决方案1】:

    如果您将xml 保存在res/raw 中而不是res/xml,您应该可以使用openRawResource

    getResources().openRawResource(R.raw.xml_name)
    

    返回InputStream

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-03
      • 2018-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-02
      • 1970-01-01
      相关资源
      最近更新 更多