XML RPC for android - Unable to create the XML parse: org.xml.sax.SaxNotRecognizedException

烂漫一生 提交于 2019-12-06 07:14:12

问题


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

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.

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


回答1:


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).

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
    }

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



来源:https://stackoverflow.com/questions/13562516/xml-rpc-for-android-unable-to-create-the-xml-parse-org-xml-sax-saxnotrecogniz

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!