Skip to main content

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

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

minidom_ext-0.0.2.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minidom_ext-0.0.2-py2.py3-none-any.whl (4.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file minidom_ext-0.0.2.tar.gz.

File metadata

  • Download URL: minidom_ext-0.0.2.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • 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

Hashes for minidom_ext-0.0.2.tar.gz
Algorithm Hash digest
SHA256 93c96fd581d18cd1bc425122a46da6c92be670032a1c0b43ebc26517ecf2afcf
MD5 fe029de4a0f15f9c799baaeeeb27721a
BLAKE2b-256 682adf9a59632490e996e8690eed8f8d5344494bbe5e4d883b8be3bc3f20faf0

See more details on using hashes here.

File details

Details for the file minidom_ext-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: minidom_ext-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.9 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

Hashes for minidom_ext-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5f53df132bdb35229485acd13f8fbbd72832c59442481cd36032f812fd320087
MD5 8ec6a948a47eb3b87a29d101e345ea55
BLAKE2b-256 ba88a8604dc8fb4919c2f72bcde262352c5af64f52d3205f91c9cd93a52214ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page