def build_element(self, name, child=None, attrs=None):
"""Build XML element
:param name:
:param child:
:param attrs:
:return: :class:`~xml.dom.minidom.Element`
"""
if attrs is None:
attrs = {}
xdoc = minidom.Document()
e = xdoc.createElement(name)
for attr_k, attr_v in attrs.items():
e.setAttribute(attr_k, attr_v)
if child is not None:
e.appendChild(child)
return e
评论列表
文章目录