Metadata-Version: 2.3
Name: rxml
Version: 1.1.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Classifier: License :: OSI Approved :: MIT License
License-File: LICENSE
Summary: RXML is a python library to read and write xml files up to 2 times faster than python's xml included library.
Author-email: Matheus Mendes <mattheus2015@yahoo.com.br>
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/nephi-dev/rxml

# rxml

## What is rxml?

`rxml` is a simple python library to read xml files up to 2 times faster than python's `xml(ElementTree)` library.

## Installation

To install `rxml` you can use `pip`:

```bash
pip install rxml
```

Simply as that!

## Example usage

To a given xml with `test.xml` as name:

```xml
<?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:

```python
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:

```python
for node in root_node.children:
    # do something with the node here
```

You can also write it to a file or string(refer to the `.pyi` file for the args).

```python
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")
```

## Node attributes

This is how the `Node` looks like:

```python
class Node:
    name: str
    attrs: dict[str, str]
    children: list[Node]
    text: str
```

