gpt4 book ai didi

android - documentbuilderfactory 不适用于 android 3.0

转载 作者:行者123 更新时间:2023-11-29 22:24:42 25 4
gpt4 key购买 nike

这是我用于 android 2.3 的代码。它用于正常工作。但是不知道为什么它在 android 3.0 中似乎不起作用

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try
{

try
{
while(this.xml.available()>0)
Log.e("content", ""+this.xml.read());
}
catch (Exception e) {
// TODO: handle exception
Log.e("error", "while reading the file");
}
this.xml.reset();

DocumentBuilder builder = factory.newDocumentBuilder();
Document dom = builder.parse(this.xml);
Element root = dom.getDocumentElement();
Log.d(TAG, "have root?"+dom.getLocalName());;
Log.d(TAG, "have root?"+dom.getInputEncoding());;
Log.d(TAG, "have root?"+dom.getNodeValue());;
}
catch (Exception e)
{
Log.e(TAG, e.getMessage(), e);
}
//Log.d(TAG, "Exit: parse");
return stores;
}

内部同时以数字显示文件内容。但是当我得到 dom.* 我得到 null 为什么会这样?

有什么建议吗?

最佳答案

实际上在 Android 3.0 之前的 Android 版本的 DOM 中存在一些错误这些错误在 3.0 中得到纠正,因此您使用 DOM 完成的旧实现中可能需要进行一些更改

请引用此链接

http://code.google.com/p/android/issues/detail?id=2735#c11

干杯喜满树

关于android - documentbuilderfactory 不适用于 android 3.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6263642/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com