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 and 3.0.8 against the
official XML Schema.
- Free software: BSD license
On Windows you can download the standalone binary command line tool: onixcheck-0.9.7_win.zip
If you have Python or PyPy installed on your system you can do the usual:
pip install onixcheck
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
Show help:
onixcheck -h
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)
https://onixcheck.readthedocs.org/
To run the all tests run:
tox
Contributions/suggestions are welcome.