acdh-xml-validator
A Python package for validating XML files against RelaxNG and Schematron schemas. This module provides a Validator class that can validate XML documents using both RelaxNG (.rng) and Schematron (.sch) schemas, particularly useful for TEI (Text Encoding Initiative) XML documents.
Installation
pip install acdh-xml-validator
or
uv add acdh-xml-validator`
Usage (CLI)
RNG and Schematron
uv run validate-all --files "data/editions/*.xml" --rng "schemata/rng.rng" --schematron "schemata/schematron.sch"
RNG
uv run validate-rng --files "data/editions/*.xml" --rng "schemata/rng.rng"
SCHEMATRON
uv run validate-schematron --files "data/editions/*.xml" --schematron "schemata/schematron.sch"
Usage (Python)
import glob
from acdh_xml_validator import Validator
validator = Validator(
path_to_rng="schemata/rng.rng",
path_to_schematon="schemata/schematron.sch"
)
files = glob.glob("data/editions/*.xml")
for x in files:
valid = validator.validate(x)
result:
test/xmls/L00003.xml is not valid according to test/schemata/rng.rng schema
- test/xmls/L00003.xml:120:0:ERROR:RELAXNGV:RELAXNG_ERR_ELEMNAME: Expecting element idno, got rs
- test/xmls/L00003.xml:119:0:ERROR:RELAXNGV:RELAXNG_ERR_ELEMNAME: Expecting element dateline, got signed
- test/xmls/L00003.xml:119:0:ERROR:RELAXNGV:RELAXNG_ERR_ELEMWRONG: Did not expect element signed there
- test/xmls/L00003.xml:87:0:ERROR:RELAXNGV:RELAXNG_ERR_ELEMWRONG: Did not expect element p there
- test/xmls/L00003.xml:119:0:ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element div has extra content: closer
- test/xmls/L00003.xml:79:0:ERROR:RELAXNGV:RELAXNG_ERR_CONTENTVALID: Element text failed to validate content
test/xmls/L00107.xml is not valid according to test/schemata/tillich-schematron.sch
- The @ref attribute for rs type @bible must start with a captial letter or with a number
- The @ref attribute for rs type @bible must start with a captial letter or with a number
- The @ref attribute for rs type @bible must start with a captial letter or with a number
develop
install the package in editable mode
uv pip install -e .
uv run python
>>> from acdh_xml_validator import hello
>>> hello()
'Hello you from acdh-xml-validator!'
Metadata
Release files for acdh-xml-validator 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| acdh_xml_validator-1.1.0.tar.gz | 4.1 kB | Without provenance | Details for acdh_xml_validator-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| acdh_xml_validator-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for acdh_xml_validator-1.1.0-py3-none-any.whl |
Total release size: 9.9 kB
Release files / acdh_xml_validator-1.1.0.tar.gz
| Download URL | acdh_xml_validator-1.1.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4b901ff51d2975492142b0276d3145e58764baf536005bcd2857ea19bbdab8b
|
|
BLAKE2b-256 checksum How to use checksums |
3118b5177de7f8b4b2d21ff9b408c40fd4bfefab16de25b44361187559831a35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Release files / acdh_xml_validator-1.1.0-py3-none-any.whl
| Download URL | acdh_xml_validator-1.1.0-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
290b8f1a0226ec8433f408b25e6ae28513507e65e2234d2e5b985a921b92d1e7
|
|
BLAKE2b-256 checksum How to use checksums |
4f072c83e008bfce0ba4871274a71c258a3b013950f2f0d0884df9f7ae6680e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Security for acdh-xml-validator 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.