Skip to content

Repository files navigation

Onixcheck - Book Trade Metadata Validation

PyPI Package PyPI Downloads DeepWiki

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

Windows Binary

For Windows users who prefer not to install Python, standalone executables are available on the GitHub Releases page.

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.

About

ONIX validation library and commandline tool

Topics

Resources

Stars

27 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages