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
Metadata
Release files for minidom-ext 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| minidom_ext-0.0.6.tar.gz | 24.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| minidom_ext-0.0.6-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 41.5 kB
Release files / minidom_ext-0.0.6.tar.gz
| Download URL | minidom_ext-0.0.6.tar.gz |
|---|---|
| Size | 24.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
367a77bed0abbd9c0240720bd606c51dd43eca2515583a3fd1e60edd83d71017
|
|
BLAKE2b-256 checksum How to use checksums |
6d231a24a5d220ad9dbb89f9d5b5266e706c5bdcb675cf3b32f55175321ecb95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / minidom_ext-0.0.6-py2.py3-none-any.whl
| Download URL | minidom_ext-0.0.6-py2.py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e69f0c2531b5918ad752f5a153a89735fecc9e133e98ba42c25c65f688eb0bf2
|
|
BLAKE2b-256 checksum How to use checksums |
a06cf8d53de98eec23d2a4e00198bff0b6d31a2a0675f5cc5312138f276b9139
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|