Jython和SAX解析器:最多允许64000个实体吗? [英] Jython and the SAX Parser: No more than 64000 entities allowed?
本文介绍了Jython和SAX解析器:最多允许64000个实体吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Jython中对大型XML文件(800 MB)进行了xml.sax
解析器的简单测试,并遇到以下错误:
I've done a simple test of the xml.sax
parser in Jython on a large XML file (800 MB) and encountered the following error:
Traceback (most recent call last):
File "src/project/xmltools.py", line 92, in <module>
sys.exit(main())
File "src/project/xmltools.py", line 87, in main
parser.parse(open(argv[1], "r"))
File "/amd.home/home/user/workspace/jython-2.5.2/Lib/xml/sax/drivers2/drv_javasax.py", line 146, in parse
self._parser.parse(JyInputSourceWrapper(source))
File "/amd.home/home/user/workspace/jython-2.5.2/Lib/xml/sax/drivers2/drv_javasax.py", line 59, in fatalError
self._err_handler.fatalError(_wrap_sax_exception(exc))
File "/amd.home/home/user/workspace/jython-2.5.2/Lib/xml/sax/handler.py", line 38, in fatalError
raise exception
xml.sax._exceptions.SAXParseException: <unknown>:1:1: The parser has encountered more than "64,000" entity expansions in this document; this is the limit imposed by the application.
此由应用程序施加的限制"有什么问题,我该如何覆盖呢?
What is the matter with this "limit imposed by the application" and how can I override it?
我试图使用Java XML库nu.xom
并遇到相同的错误.
I have tried to use the Java XML library nu.xom
and ran into the same error.
推荐答案
尝试将entityExpansionLimit
属性设置为高于64000的值.请参见
Try setting the entityExpansionLimit
property to a higher value than 64000. See http://download.oracle.com/javase/1.5.0/docs/guide/xml/jaxp/JAXP-Compatibility_150.html#JAXP_security.
这篇关于Jython和SAX解析器:最多允许64000个实体吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文