python处理xml的三种常见机制
dom(随机访问机制)
sax(Simple APIs for XML,事件驱动机制)
etree
python处理xml的三种包
标准库中的xml
Fredrik Lundh 的 ElementTree
Stefan Behnel 的 lxml
对以上三种包的介绍和对比
With the continued growth of both Python and XML, there is a plethora(过剩/过多) of packages out there that help you read, generate, and modify XML files from Python scripts. Compared to most of them, the lxml package has two big advantages:
Performance. Reading and writing even fairly large XML files takes an almost imperceptible(小得无法察觉的) amount of time.
Ease of programming. The lxml package is based on ElementTree, which Fredrik Lundh invented to simplify and streamline XML processing.
lxml is similar in many ways to two other, earlier packages:
Fredrik Lundh continues to maintain his original version of ElementTree.
xml.etree.ElementTree is now an official part of the