ioc_writer.utils package¶
Submodules¶
ioc_writer.utils.xmlutils module¶
-
ioc_writer.utils.xmlutils.
delete_namespace
(parsed_xml)¶ Identifies the namespace associated with the root node of a XML document and removes that names from the document.
Parameters: parsed_xml – lxml.Etree object. Returns: Returns the sources document with the namespace removed.
-
ioc_writer.utils.xmlutils.
read_xml
(filename)¶ Use et to read in a xml file, or string, into a Element object.
Parameters: filename – File to parse. Returns: lxml._elementTree object or None
-
ioc_writer.utils.xmlutils.
read_xml_no_ns
(filename)¶ read in the file or data, populating a lxml._elementTree object stripping out namespaces
Parameters: filename – filename representing a xml file or a string of xml data Returns: lxml._elementTree object or None
-
ioc_writer.utils.xmlutils.
remove_namespace
(doc, namespace)¶ Takes in a ElementTree object and namespace value. The length of that namespace value is removed from all Element nodes within the document. This effectively removes the namespace from that document.
Parameters: - doc – lxml.etree
- namespace – Namespace that needs to be removed.
Returns: Returns the source document with namespaces removed.