An implementation of lxml.xmlfile for the standard library
Project description
et_xmfile
XML can use lots of memory, and et_xmlfile is a low memory library for creating large XML files And, although the standard library already includes an incremental parser, iterparse it has no equivalent when writing XML. Once an element has been added to the tree, it is written to the file or stream and the memory is then cleared.
This module is based upon the xmlfile module from lxml with the aim of allowing code to be developed that will work with both libraries. It was developed initially for the openpyxl project, but is now a standalone module.
The code was written by Elias Rabel as part of the Python Düsseldorf openpyxl sprint in September 2014.
Proper support for incremental writing was provided by Daniel Hillier in 2024
Note on performance
The code was not developed with performance in mind, but turned out to be faster than the existing SAX-based implementation but is generally slower than lxml’s xmlfile. There is one area where an optimisation for lxml may negatively affect the performance of et_xmfile and that is when using the .element() method on the xmlfile context manager. It is, therefore, recommended simply to create Elements write these directly, as in the sample code.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file et_xmlfile-2.0.0.tar.gz
.
File metadata
- Download URL: et_xmlfile-2.0.0.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dab3f4764309081ce75662649be815c4c9081e88f0837825f90fd28317d4da54 |
|
MD5 | d7db773c110c5534e61f288fdfcad807 |
|
BLAKE2b-256 | d338af70d7ab1ae9d4da450eeec1fa3918940a5fafb9055e934af8d6eb0c2313 |
File details
Details for the file et_xmlfile-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: et_xmlfile-2.0.0-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a91720bc756843502c3b7504c77b8fe44217c85c537d85037f0f536151b2caa |
|
MD5 | 2a0e42a250b2d8a56497969eb14a979d |
|
BLAKE2b-256 | c18b5fe2cc11fee489817272089c4203e679c63b570a5aaeb18d852ae3cbba6a |