Skip to main content

ONIX validation library and commandline tool

Project description

Onixcheck - Book Trade Metadata Validation

PyPI Package PyPI Downloads

Introduction

ONIX for Books is an international XML standard for the publishing and book trade industry.

onixcheck is a Python library and command line tool for validating ONIX metadata. It allows you to validate ONIX versions 2.1, 3.0, and 3.1 against the official XML Schema.

  • Free software: Apache License 2.0

Installation

Using uv (Recommended)

For the fastest and most reliable installation, we recommend using the uv tool:

uv tool install onixcheck

Using pip

If you have Python or PyPy installed on your system:

pip install onixcheck

Quickstart

Command line usage examples

Validate all .xml, .onx, .onix files in current directory:

onixcheck

Validate a single onix file:

onixcheck myonixfile.xml

Validate all .xml files in /onixdata and its subdirectories:

onixcheck --path /onixdata --ext xml --recursive

Enable debug information (more detailed error output):

onixcheck myonixfile.xml --debug

Show help:

onixcheck -h

Using onixcheck as a Python library

Simple usage with onixcheck.validate:

import onixcheck
errors = onixcheck.validate('src/onixcheck/data/invalid_onix3_ref.xml')
print(errors[0].short)
ERROR - SCHEMASV - invalid_onix3_ref.xml:4:0 - Element 'SentDateTime': This element is not expected. Expected is ( Sender ).

errors is either a list of Message objects (INVALID file) or an empty list (VALID file)

Custom schema validation

You can specify custom schema types for validation:

import onixcheck
errors = onixcheck.validate('myfile.xml', schemas=('xsd', 'rng', 'google'))

Contributions and suggestions are welcome. Please feel free to open issues or pull requests on GitHub.

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

onixcheck-0.9.9.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

onixcheck-0.9.9-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file onixcheck-0.9.9.tar.gz.

File metadata

  • Download URL: onixcheck-0.9.9.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for onixcheck-0.9.9.tar.gz
Algorithm Hash digest
SHA256 094064b3e7f2b1cbc180f2c7729300a9e6a4777fe4436d133cc07da78cb8f34f
MD5 a83f5725156672d7604fdf0ec2ad4350
BLAKE2b-256 0b7a38c967d3578c8f94df524bb4d3f0df5e2a813410ab019b3642749a05143e

See more details on using hashes here.

File details

Details for the file onixcheck-0.9.9-py3-none-any.whl.

File metadata

File hashes

Hashes for onixcheck-0.9.9-py3-none-any.whl
Algorithm Hash digest
SHA256 446035121c24e9e8e90420b591ab118a9b96134eb6cae4362e4c51c8cd61e070
MD5 2e01712659c6e7dc1bd8dc1b0ff94838
BLAKE2b-256 46799b62a16023b6dbabab30d3947ce6ac499614416d3af1a6ebc69d2ecd816b

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page