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

后端 未结 4 1245
醉梦人生
醉梦人生 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:50

    I am not a Java developer, but I "think" Java xml classes support a similar functionality to .net for accomplishing this. IN .net the xmlreadersettings class you set the ProhibitDtd property false and set the XmlResolver property to null. This will cause the parser to ignore externally referenced entities without throwing an exception when they are read. I just did a google search for "Java ignore enity" and got lots of hits, some of which appear to address this topic. I realize this is not a total answer to your question but it should point you in a useful direction.

提交回复
热议问题