Minidom extension
Project description
Minidom Extension
Short presentation
Functions to improve xml.dom.minidom [1] tools in Python.
class DOMCompanion :
- def init(self, doc = None) : to build a DOM DocumentCompanion
- def parse(self, file, validate = False): to load an XML file
- def getElementsByTagName(self, name) : DOM getElementsByTagName
- def getElementById(self, id) : to retrieve an element by its ID
- def getAttributsByIdref(self, id) : to retrieve attributs that refers to an ID
- def toLighter(self, del_spaces = True, del_comments = True, del_pi = True) : to suppress text nodes (with only separators), processing instructions and/or comments
- def validate(self) : to validate the XML according its DTD (enrich it too)
Exemple
from minidom_ext.DOMCompanion import DOMCompanion
cine = DOMCompanion()
cine.parse("semaine10.xml", True)
print(cine.doc.toxml())
print(cine.getElementById('Ka'))
print(cine.toLighter().toxml())
How to install ?
pip install minidom-ext
Links
[1] Python 'minidom' : https://docs.python.org/3/library/xml.dom.minidom.html
[2] DOM using Python : https://docs.python.org/3/library/xml.dom.html
(c) E. Desmontils, University of Nantes, november 2020
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file minidom_ext-0.0.6.tar.gz.
File metadata
- Download URL: minidom_ext-0.0.6.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/29.0 requests/2.24.0 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.47.0 importlib-metadata/4.8.3 keyring/21.2.1 rfc3986/1.4.0 colorama/0.4.4 CPython/3.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
367a77bed0abbd9c0240720bd606c51dd43eca2515583a3fd1e60edd83d71017
|
|
| MD5 |
215274476fba6385c411741095e5467f
|
|
| BLAKE2b-256 |
6d231a24a5d220ad9dbb89f9d5b5266e706c5bdcb675cf3b32f55175321ecb95
|
File details
Details for the file minidom_ext-0.0.6-py2.py3-none-any.whl.
File metadata
- Download URL: minidom_ext-0.0.6-py2.py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e69f0c2531b5918ad752f5a153a89735fecc9e133e98ba42c25c65f688eb0bf2
|
|
| MD5 |
1bab596ad3bdaf151773a1c8d5ab0a06
|
|
| BLAKE2b-256 |
a06cf8d53de98eec23d2a4e00198bff0b6d31a2a0675f5cc5312138f276b9139
|