对于大于15 GB的文件,您选择Perl XML解析器是什么? [英] What would be your choice of Perl XML Parsers for files greater than 15 GB?

查看:77
本文介绍了对于大于15 GB的文件,您选择Perl XML解析器是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有一些非常好的Perl XML解析器,例如 XML :: Xerces XML :: Parser :: Expat XML :: Simple ,XML :: RapidXML, XML :: Liberal 等.

I know there are some very good Perl XML parsers like XML::Xerces, XML::Parser::Expat, XML::Simple, XML::RapidXML, XML::LibXML, XML::Liberal, etc.

您将选择哪个XML解析器来解析大文件,您将根据哪个参数来决定一个?如果您要选择的一个不在列表中,请提出建议.

Which XML parser would you select for parsing large files and on what parameter would you decide one over another? If the one you would like to select is not in list then please suggest it.

推荐答案

如果要解析该大小的文件,则需要避免任何试图将整个文档加载到内存中并构造DOM(域)的解析器.对象模型).

If you're parsing files of that size, you'll want to avoid any parser that tries to load the entire document in memory and construct a DOM (domain object model).

相反,寻找一个 SAX 样式解析器-它将输入文件视为流,从而引发遇到事件和属性时发生的事件.这种方法使您可以逐步处理文件,而不必一次将整个文件保存在内存中.

Instead, look for a SAX style parser - one that treats the input file as a stream, raising events when events and attributes are encountered. This approach allows you to process the file gradually, without having to hold the entire thing in memory at once.

这篇关于对于大于15 GB的文件,您选择Perl XML解析器是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆