magpie.xml_util
¶
Define a default XML parser that avoids XXE injection.
Package lxml
is employed directly even though some linters (e.g.: bandit
) report to employ defusedxml
instead, because that package’s extension with lxml
is marked as deprecated.
To use the module, import is as if importing lxml.etree
:
from weaver.xml_util import XML # ElementTree
from weaver import xml_util
data = xml_util.fromstring("<xml>content</xml>")
Module Contents¶
Functions¶
|
Drop in replacement for |
|
Strip the namespace component from all tags in the specified XML tree. |