Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rxml

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rxml

RXML is a python library to read and write xml files up to 2 times faster than python's xml included library.

  • 2.1.1
  • PyPI
  • Socket score

Maintainers
1

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:

pip install rxml

Simply as that!

Example usage

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 here

You 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")

Node attributes

This is how the Node looks like:

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc