ogstools.ogs6py.build_tree module#
- class ogstools.ogs6py.build_tree.BuildTree[source]#
Bases:
objectHelper class to create a nested dictionary representing the xml structure.
- static populate_tree(parent, tag, text=None, attr=None, overwrite=False)[source]#
Add an element to the xml tree.
- Parameters:
parent (
Element) – Parent of the new element.tag (
str) – Tag of the new element.text (
Any|list|dict|None) – Text / value of the new element. If given a dict, the key and value pairs will create corresponding subelements.attr (
dict[str,str] |None) – Attributes of the new element.overwrite (
bool) – If True, overrides the last child of parent with a matching tag.
- Return type:
- static find_or_populate(parent, tag)[source]#
Find an existing tag in parent or create it.
- Return type: