如何增加 entityExpansionLimit 以使用 SAX 解析 XML 文件 [英] How to increase entityExpansionLimit for parsing XML files using SAX
问题描述
我正在尝试使用 Java 中的 SAX 解析器解析 1.23 GB 的 XML 文件.我使用的是 Mac OS 和 JDK 1.7.0.51.不幸的是,我收到以下错误:
I am trying to parse an XML file which is 1.23 GB using SAX parser in Java. I am using Mac OS and JDK 1.7.0.51. Unfortunately, I am getting the following error:
The pasrser has encountered more than "64000" entity expansions in this document; this is the limit imposed by the JDK.
我被建议扩展实体扩展,但不知道如何执行此操作.任何人都可以帮助我解决这个问题.非常感谢您的帮助.
I have been recommended to get the entity expansion extended but do not know how to do this. Could anyone please help me in this issue. Your help would be very much appreciated.
推荐答案
我找到了解决此问题的方法.目前它正在与我合作.我正在使用 Eclipse.以下是步骤:
I found a solution for this issue. It is working with me at the moment. I am using Eclipse. Here are the steps:
1- Right-click on the project in Eclipse
2- Select Run -> Run Configurations
3- Select Arguments
4- In the VM arguments, add the following: -DentityExpansionLimit=2500000
希望这对可能遇到此问题的人有所帮助.
Hope this helps people who may encounter this issue.
这篇关于如何增加 entityExpansionLimit 以使用 SAX 解析 XML 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!