2018-02-03 20:40:17 +00:00
|
|
|
#!/usr/bin/env python3
|
2018-02-03 00:36:08 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2018-02-03 20:40:17 +00:00
|
|
|
# pylint: disable=C0111,C0326,C0103
|
|
|
|
|
2018-02-03 21:25:26 +00:00
|
|
|
"""XML tools."""
|
|
|
|
|
2018-02-03 00:36:08 +00:00
|
|
|
import xml.dom.minidom
|
|
|
|
|
2018-02-03 20:24:36 +00:00
|
|
|
|
2018-02-03 12:46:17 +00:00
|
|
|
class XmlToolsMixin:
|
2018-02-03 21:25:26 +00:00
|
|
|
"""A mixin component for XML tools."""
|
2018-02-03 00:36:08 +00:00
|
|
|
@staticmethod
|
|
|
|
def pretty_xml(xmlstr):
|
2018-02-03 21:25:26 +00:00
|
|
|
"""Prettify input XML with ``xml.dom.minidom``."""
|
2018-02-03 00:36:08 +00:00
|
|
|
mdx = xml.dom.minidom.parseString(xmlstr)
|
|
|
|
return mdx.toprettyxml(indent=" ")
|