maci docs
  • maci
  • WATCH
    • Quick Start
    • Full Training Series
  • DOCS
    • maci
      • language
        • v1.0.0
      • functions
        • maci.build
        • maci.load
        • maci.loadstr
        • maci.loadattrs
        • maci.loadraw
        • maci.loaddict
        • maci.loadstrdict
        • maci.dump
        • maci.dumpstr
        • maci.dumpraw
      • object
        • methods
          • lock_attr
          • unlock_attr
          • hard_lock_attr
          • map_attr
          • unmap_attr
          • load_attrs
          • get_attrs
          • get_locked_list
          • get_hard_locked_list
          • get_all_maps
          • get_parent_maps
          • get_child_maps
          • get_parent_map_chains
          • is_parent_map
          • is_child_map
      • errors
      • hints
    • json
      • functions
        • maci.jsonload
        • maci.jsonloadstr
        • maci.jsondump
        • maci.jsondumpstr
    • yaml
      • functions
        • maci.yamlload
        • maci.yamlloadstr
        • maci.yamlloadall
        • maci.yamldump
        • maci.yamldumpstr
        • maci.yamldumpall
    • toml
      • functions
        • maci.tomlload
        • maci.tomlloadstr
        • maci.tomldump
        • maci.tomldumpstr
    • ini
      • functions
        • maci.iniload
        • maci.inidump
        • maci.inibuildauto
        • maci.inibuildmanual
    • xml
      • functions
        • maci.xmlload
        • maci.xmlloadstr
        • maci.xmlloaddict
        • maci.xmlloadstrdict
        • maci.xmldump
        • maci.xmldumpstr
        • maci.xmldumpdict
        • maci.xmldumpstrdict
        • maci.xmlbuildmanual
        • maci._defuse_xml_stdlib
    • pickle
      • functions
        • maci.pickleloadbytes
        • maci.pickledumpbytes
    • tools
      • hash functions
        • maci.createhash
        • maci.createfilehash
        • maci.comparefilehash
      • format functions
        • maci.cleanformat
  • Updates
    • Changelog
      • v1.1.0
      • v1.0.0
Powered by GitBook
On this page
  1. DOCS
  2. xml
  3. functions

maci.xmlbuildmanual

gets the elementtree module object to build elements

Last updated 1 year ago

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

maci.xmlbuildmanual ->

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

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 module with the xmlbuildmanual function, and created a new 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: Documentation:

partner functions

Functions that are related for ElementTree

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.

-> Loads xml data from a file as Element or ElementTree object -> Loads xml data from a string as Element object -> Dumps xml data to a file from xml etree ElementTree or Element object -> Dumps xml data to a string from xml etree Element object -> 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:

Additionally, see the provided tooling to potentially assist with vulnerabilities

ElementTree
Element
ElementTree
ElementTree Module
ElementTree Module
xmldump
ElementTree
ElementTree
https://www.youtube.com/results?search_query=python+xml+etree
https://docs.python.org/3/library/xml.etree.elementtree.html
maci.xmlload
maci.xmlloadstr
maci.xmldump
maci.xmldumpstr
maci._defuse_xml_stdlib
https://docs.python.org/3/library/xml.etree.elementtree.html
_defuse_xml_stdlib