Is there a Java XML API that can parse a document without resolving character entities?

后端 未结 4 1244
醉梦人生
醉梦人生 2020-11-27 23:03

I have program that needs to parse XML that contains character entities. The program itself doesn\'t need to have them resolved, and the list of them is large and will chan

4条回答
  •  孤独总比滥情好
    2020-11-27 23:51

    Works for me only when disabling support of external entities:

    XMLInputFactory inputFactory = XMLInputFactory.newInstance();
    inputFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
    inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
    

提交回复
热议问题