Skip to main content

A ClaML reader for Python.

Project description

Build status codecov

A ClaML reader for Python. Generated from the ClaML.dtd file from the DIMDI, using PyXB.

Features

Reads classification files in ClaML format (XML) into Python objects. See examples/test1.py for a usage example.

Resources

Usage

To use ClaML reader in a project:

import python_claml

Example

Read and parse the contents of a ClaML file and print all class codes:

with open(file_name, 'r') as input_file:
    # Read file contents
    contents = input_file.read()
    # Parse ClaML document
    classification: ClaML = claml.CreateFromDocument(contents)
    for cls in classification.Class:
        print(cls.code)

Development

The code was generated using the following commands:

pyxbgen --schema-root=../resources -u ClaML.xsd -m python_claml.claml

Install

From the package index:

pip install python-claml

or from source:

git clone https://github.com/thehyve/python_claml.git
cd python_claml
pip install .

Test

python setup.py test

License

Copyright (c) 2019 The Hyve B.V.

The ClaML reader is licensed under the MIT License. See the file LICENSE.

Project details


Release history Release notifications

Download files

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

Files for python-claml, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size python_claml-0.1.0-py2.py3-none-any.whl (18.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size python_claml-0.1.0.tar.gz (19.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page