Skip to main content

Comprehensive XML generator for Python

Project description

Project Name

Comprehensive XML generator for Python

Table of Contents

Installation

pip install xml-generator

Usage

Import

from xml_generator.types import XmlNode

Comprehensive parsing

Parse Comprehensive format into an XmlNode object.

node = XmlNode.parse(
    {
        "name": "node",
        "attributes": {"attr1": "value1", "attr2": "value2"},
        "body": [
            {"name": "child1", "attributes": {"attr1": "value1"}},
            {"name": "child2", "attributes": {"attr2": "value2"}},
        ],
    }
)

Searching a specific node

Return the first XmlNode with the given query. Query can be a name with attributes.

parent = node.find("node")
child1 = node.find("child1@attr1")
child2 = node.find("child2")

Generate a xml file

Using the to_xml() function that return the XmlNode as an XML string.

with open('sample.xml', 'w', encoding='utf-8') as f:
    f.write(node.to_xml())

Contributing

Coming soon.

License

License :: OSI Approved :: MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xml-generator-seobaeksol-0.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xml_generator_seobaeksol-0.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file xml-generator-seobaeksol-0.0.1.tar.gz.

File metadata

File hashes

Hashes for xml-generator-seobaeksol-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c5d908ad9f8dc8896dd4ad6e426938d0ad1fa487afcb0977cbf6cda86812a218
MD5 f7558fe9aba0370b73c701a003711d70
BLAKE2b-256 7308f27b7ed270ccf912ba21cf573f767b68b7c1707f2f4e2f70270a526ecf66

See more details on using hashes here.

File details

Details for the file xml_generator_seobaeksol-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for xml_generator_seobaeksol-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bef95e3802c5250e578e2504d4a65e48e7f52902c0888b046f7b09731acad3e5
MD5 0780f4e11e198064c679cf807a05691f
BLAKE2b-256 a7d48b414f31320dd5dd33bcc6ea11fcf411c55cf8e67be756c413601143eaf7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page