PyXML是一套用Python解析和处理XML文档的工具包,包中的4DOM是完全相容于W3C DOM规范的。它包含以下内容:
xmlproc: 一个符合规范的XML解析器。
Expat: 一个快速的,非验证的XML解析器。
sgmlop: a C helper module that can speed-up xmllib.py and sgmllib.py by a factor of 5.
PySAX: SAX 1 and SAX2 libraries with drivers for most of the parsers.
4DOM: A fully compliant DOM Level 2 implementation
javadom: An adapter from Java DOM implementations to the standard Python DOM binding.
pulldom: a DOM implementation that supports lazy instantiation of nodes.
marshal: a module with several options for serializing Python objects to XML, including WDDX and XML-RPC.
安装
到http://sourceforge.net/project/showfiles.php group_id=6473下载最新版的模块,现在是PyXML-0.8.3。安装PyXML需要有python2.0以上及以上的版本。下载完成后用tar解压缩生成PyXML-0.8.3目录,进入该目录并运行python setup.py build和python setup.py install完成安装。测试方法是进入命令行交互界面运行“import xml.dom.ext"命令,如果没提示模块出错则说明安装成功。PyXML提供windows平台的安装包,下载后双击运行就可以了。
使用
由于该模块的内容较多,所以该模块的详细使用将我在“PyXML学习笔记”中单独讨论。