Skip to main content

Convert XML Schema Definitions to Voluptuous schemas.

Project description

xsd-to-vol

Tox Code style: black Open Issues Release

Convert XML Schema Definition files to voluptuous schemas.

Binary file usage

Basic usage:

xml-to-vol -i schema.xsd -o schema.py

Basic pipe usage:

cat schema.xsd | xml-to-vol > schema.py

Pipe through black formatter:

cat schema.xsd | xsd-to-vol | black - > schema.py

Advanced piping example with curl:

curl -s https://api-test.geofox.de/gti/public/geofoxThinInterfacePublic.xsd 2>&1 | xsd-to-vol | black - > schema.py

You can also mix input/output files and stdin/stdout.

Library usage

You can also use the xml_to_vol method to convert your schema:

from xsd_to_vol import xsd_to_vol

with open("schema.xsd", 'r') as schema_file:
    xsd = schema_file.read()
    print(xsd_to_vol(xsd))

To Do

While the generation should work for most xsd files, there are some features I'd like to have in future versions:

  • Only include used imports: Currently all possible voluptuous requirements are imported. The required imports can be determined.
  • Tests: Gather different xsd schemas and build pytests to test the generation.
  • Automatic code formatting: Run black over the code (without piping).

Contributions are welcome!

If you want to contribute to this, please read the Contribution guidelines

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

xsd-to-vol-0.0.1.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

xsd_to_vol-0.0.1-py2.py3-none-any.whl (9.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file xsd-to-vol-0.0.1.tar.gz.

File metadata

  • Download URL: xsd-to-vol-0.0.1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.2

File hashes

Hashes for xsd-to-vol-0.0.1.tar.gz
Algorithm Hash digest
SHA256 cf26b296d12caf99f2a3fbe03cddb601374379169f183e94698370f3a4711087
MD5 1513de2a6483716238da0e517e1c43ba
BLAKE2b-256 9ae9bb06693f710ed98bd0206309dfab16c01f47cfc8d4d9150032121f448a58

See more details on using hashes here.

File details

Details for the file xsd_to_vol-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: xsd_to_vol-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.2

File hashes

Hashes for xsd_to_vol-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a4f69b06498dd74ec28d2b435fde20706b26025eeb5cbb1e6834a6253564616b
MD5 27d7a1ed025ce0cc695cb090e76dbddc
BLAKE2b-256 25a14264a6848e186fa4b5d05c3f22696ec337b10543387182e628d44fe50d28

See more details on using hashes here.

Supported by

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