Lightning talk for EuroPython 2012 on how to write large XML files with unicode characters and namespaces in Python. The video of the talk is available from http://www.youtube.com/watch?v=f1t2M2wcY2k#t=26m20s. The source code examples can be found at https://gist.github.com/3067859.
xml.dom.minidom Explicit attribute for name space Verbose way to add attributes Many lines of code
xml.dom.minidom● “Users [...] who would like to write less code for processing XML files should consider using the xml.etree.ElementTree module instead” (The Python Standard Library, Chapter 19, Structured Markup) http://www.destructoid.com/blogs/Sevre/femshep-5-a-space-opera-208844.phtml
loxun Supports with- statement Streaming interface for low memory usage No dependencies on other modulesPure Python 2.5+ Optimizes <x></x> to simply <x/>
Raises XmlError if...● ...you add references to undefined name spaces● ...if you forget to close tags (elements)● ...if you build non-well formed documents● ...if you add non-ASCII characters in 8-bit strings
Available from:● http://pypi.python.org/pypi/loxun/● https://github.com/roskakori/loxun● Open Source $ sudo pip install loxun Downloading/unpacking loxun Downloading loxun-1.3.zip Running setup.py egg_info for package loxun Installing collected packages: loxun Running setup.py install for loxunCode examples for this talk: Successfully installed loxunhttps://gist.github.com/3067859
Try loxun for: Large output in XMLwith Unicode and namespace Also writes small ASCII files!