rxml is a simple python library to read xml files up to 2 times faster than python's xml(ElementTree) library.
To install rxml you can use pip:
pip install rxmlSimply as that!
To a given xml with test.xml as name:
<?xml version="1.0" encoding="UTF-8"?>
<note example_attr="example value">
    <to>
        <name>Example Name</name>
    </to>
    <from>
        <name>Example Name</name>
    </from>
    <heading>An Example Heading</heading>
    <body>An Example Body!</body>
</note>We write the following python code:
from rxml import read_file
root_node = read_file("test.xml", "note")where "test.xml" is the file_name and "note" is the root_tag.
After that we can simply iter through the children with:
for node in root_node.children:
    # do something with the node hereYou can also write it to a file or string(refer to the .pyi file for the args).
from rxml import Node, write_file
example_node = Node(
    name="hello_world", 
    attrs={"example_attr": "example"},
    text="Hello World!"
)
write_file(example_node, "test_ex.xml")This is how the Node looks like:
class Node:
    name: str
    attrs: dict[str, str]
    children: list[Node]
    text: str