Skip to main content

Converts labeled data to xml format

Project description

distxml

Convert labeled data to xml at scale.

Installation

Run the following command:

pip install distxml

Usage

Import the the package and create an instance of XMLConverter with your desired outer xml tag.

from distxml.xml_converter import XMLConverter

xml_con = XMLConverter("Hello")

You now have an XMLConverter object, and if you print it would write <Hello /> to console. Now add data you want within the Hello tags.

data = [
    {'start':'Good morning', 'finish':' Good night'},
    {'finish':' Good evening', 'start':'Good morning again'}
]

xml_con.queue(data)

Now this data is queued in the XMLConverter object, but if you print xml_con, it will still write <Hello /> to console. To solve this, you must compile the data.

xml_con.compile("Greetings")

Now if you print, the console will read

<Hello><Greetings><start>Good morning</start><finish> Good night</finish></Greetings><Greetings><finish> Good evening</finish><start>Good morning again</start></Greetings></Hello>

Finally, to write to a file, just use

xml_con.write_to_file("filepath/file.xml")

And there you go, a new xml file!

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

distxml-0.1.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

distxml-0.1.1-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file distxml-0.1.1.tar.gz.

File metadata

  • Download URL: distxml-0.1.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for distxml-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cc34ed5208993230d502c47208871ba7ae06aedbf18fbf5b4892480568a9af5a
MD5 b7b9ba136f7c76e581a698e0ad68761d
BLAKE2b-256 57e4afa668fd26e565aaa2b257f81e632aff31015113f5e44b52a2b75ab5cdf1

See more details on using hashes here.

File details

Details for the file distxml-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: distxml-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for distxml-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06ff2f8629fbc0791b88a994589731e5b751f3d80e3a61fa661f895d9c58462f
MD5 a25ffe0d4ad881f0bbc67c1005197a5a
BLAKE2b-256 4f9153347a983f48d6b884c068f92d0b5b95ae5005f6f9e20a00a8b3885fb96c

See more details on using hashes here.

Supported by

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