Metadata-Version: 2.1
Name: minidom-ext
Version: 0.0.3
Summary: Minidom extension
Home-page: https://github.com/edesmontils/Minidom_ext
Author: Emmanuel Desmontils
Author-email: emmanuel.desmontils@univ-nantes.fr
Maintainer: Emmanuel Desmontils
Maintainer-email: emmanuel.desmontils@univ-nantes.fr
License: GPL V3
Keywords: minidom XML DOM
Platform: ALL
Classifier: Topic :: Education
Classifier: Topic :: Documentation
Description-Content-Type: text/markdown
Requires-Dist: lxml (>=4.5.1)

# 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


