android 的 XML RPC - 无法创建 XML 解析:org.xml.sax.Sax

XML RPC for android - Unable to create the XML parse: org.xml.sax.SaxNotRecognizedException(android 的 XML RPC - 无法创建 XML 解析:org.xml.sax.SaxNotRecognizedException)

本文介绍了android 的 XML RPC - 无法创建 XML 解析:org.xml.sax.SaxNotRecognizedException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题正是 this 问题,只有答案对我没有帮助.

My question is exactly this question, only the answer doesn't cut it for me.

答案只是指向this 讨论.问题的根源显然与链接的 SO 问题相同,但我看不出如何将线程末尾提到的解决方法应用于我的问题.

The answer simply points to this discussion. The root of the problem there is obviously the same as in the linked SO question, but I don't see how I can apply the workaround mentioned by the end of the thread to my problem.

所以问题是:在 XML-RPC 案例中,我该如何避免这个错误 - 链接的 SO-question 中描述的那个错误

So the question is: How do I go about to avoid this error in the XML-RPC case - the one described in the linked SO-question

推荐答案

一个可能的解决方法是阻止 apache xml-rpc 设置这些功能.由于这些设置无论如何都不受支持,所以这应该不是问题(对我来说很好).

A possible fix is to prevent apache xml-rpc from setting these features. As these settings are unsupported anyway it shouldn't be a problem (works fine for me).

在 3.1.3 版本中,您需要更改 org.apache.xmlrpc.util.SAXParsers 第 37-50 行:

In version 3.1.3 you need to change org.apache.xmlrpc.util.SAXParsers Lines 37-50:

    try {
        spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
    } catch (javax.xml.parsers.ParserConfigurationException e) {
        // Ignore it
    } catch (org.xml.sax.SAXException e) {
        // Ignore it
    }
    try {
        spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
    } catch (javax.xml.parsers.ParserConfigurationException e) {
        // Ignore it
    } catch (org.xml.sax.SAXException e) {
        // Ignore it
    }

只需将它们注释掉,编译并替换原来的 xmlrpc-common jar.

Just comment them out, compile it and replace the original xmlrpc-common jar.

这篇关于android 的 XML RPC - 无法创建 XML 解析:org.xml.sax.SaxNotRecognizedException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:android 的 XML RPC - 无法创建 XML 解析:org.xml.sax.Sax

基础教程推荐