mh_utils.xml¶
Functions and classes for handling XML files.
Classes:
ABC mixin to provide a function for instantiating the class from an XML file. |
Functions:
|
Returns a validated lxml objectify from the given XML file, validated against the schema file. |
-
class
XMLFileMixin[source]¶ Bases:
ABCABC mixin to provide a function for instantiating the class from an XML file.
Methods:
from_xml(element)Construct an object from an XML element.
from_xml_file(filename)Generate an instance of this class by parsing an from an XML file.
-
get_validated_tree(xml_file, schema_file=None)[source]¶ Returns a validated lxml objectify from the given XML file, validated against the schema file.
- Parameters
- Return type
_ElementTree- Returns
An lxml ElementTree object. When .getroot() us called on the tree the root will be an instance of
lxml.objectify.ObjectifiedElement.