maci.xmlbuildmanual

gets the elementtree module object to build elements

Calling this function will simply return the ElementTree module object to build out xml Element or ElementTree data manually. This function currently has no parameters.

maci.xmlbuildmanual -> ElementTree Module

Example getting ElementTree Module object and building out xml data using a person concept and dumping the data using xmldump

ET = maci.xmlbuildmanual()

root = ET.Element("person")

name = ET.SubElement(root, "name")
name.text = "John Doe"
age = ET.SubElement(root, "age")
age.text = "30"

tree = ET.ElementTree(root)

maci.xmldump('mydata.xml', tree)

In this example, we got the ElementTree module with the xmlbuildmanual function, and created a new ElementTree object structure to build out our data, assigned the final tree build to a variable, then dumped that data to a file.

Values for the sub-elements must be strings or None.

More information on using Element and ElementTree data: Youtube Video Search: https://www.youtube.com/results?search_query=python+xml+etree Documentation: https://docs.python.org/3/library/xml.etree.elementtree.html

partner functions

Functions that are related for ElementTree

maci.xmlload -> Loads xml data from a file as Element or ElementTree object maci.xmlloadstr -> Loads xml data from a string as Element object maci.xmldump -> Dumps xml data to a file from xml etree ElementTree or Element object maci.xmldumpstr -> Dumps xml data to a string from xml etree Element object maci._defuse_xml_stdlib -> Monkey patch and defuse all stdlib packages [security use]

This function uses the native xml library etree shipped with the python standard library for its underlying functionality. For more information on the xml.etree api, visit: https://docs.python.org/3/library/xml.etree.elementtree.html

Security awareness: It is important to evaluate handling XML data carefully as there are known vulnerabilities in dealing with XML data. Please refer to the official python documentation above.

Additionally, see the provided tooling to potentially assist with vulnerabilities _defuse_xml_stdlib

Last updated