Both coding styles can co-exist happily in an lxml-based application.
这两种编程风格可以在一个基于lxml的应用程序中和谐共存。
Serializing XML to a string or file is where lxml excels because it relies on libxml2 C code directly.
将XML序列化为一个字符串或文件是lxml 的长项,因为它依赖于libxml2C代码库。
This article does not cover all of lxml but instead demonstrates techniques to efficiently process very large XML files, optimizing for high speed and low memory usage.
本文并没有介绍 lxml的所有部分,但是演示了一些可以有效处理大型XML文件、进行优化以提高处理速度并减少内存使用的技术。
LXML retains references between child nodes and their parents.
lxml保持子节点及其父节点之间的引用。
The LXML parse method reads the entire document and builds an in-memory tree.
lxmlparse方法读取整个文档并在内存中构建一个树。
Consult the FAQ section on threads in the LXML documentation for more information.
要了解更多内容,可参考lxml文档中有关线程的FAQ部分。
LXML offers several approaches, from a simplified search syntax to full XPath 1.0.
lxml提供了简化的搜索语法和完整的XPath 1.0等各种方法。
Which parts of LXML you use in your code depends on your needs: Are you comfortable with XPath?
您要在代码中使用lxml的哪一部分取决于您的需求:您是否熟悉XPath ?
In addition to the use of specific methods within LXML, you can use approaches outside of the library to influence execution speed.
除了使用lxml内部的特定方法外,还可以通过库以外的方法提高执行速度。
If your task requires any serialization at all, LXML is a clear choice, but there are some tricks to get the best performance out of the library.
如果要执行要求序列化的任务,lxml无疑是最佳选择,但是需要使用一些技巧来获得最佳性能。
The output from Listing 3 will be identical to that of the target parser method in Listing 2 but ought to be much faster because LXML can optimize the event handling internally.
清单3的输出与清单2的目标解析器方法的输出相同,但是速度应该会提高很多,因为lxml可以在内部优化事件处理。
The output from Listing 3 will be identical to that of the target parser method in Listing 2 but ought to be much faster because LXML can optimize the event handling internally.
清单3的输出与清单2的目标解析器方法的输出相同,但是速度应该会提高很多,因为lxml可以在内部优化事件处理。
应用推荐