ocx-schema-parser
A Python library and CLI for parsing the OCX XSD schema into a typed, immutable model that serializes to JSON.
Installation
pip install ocx-schema-parser
Usage
CLI
# Export a remote schema to JSON
ocx-schema-parser export https://3docx.org/fileadmin/ocx_schema/V320/OCX_Schema.xsd -o ocx_schema.json
# Export a local schema file or folder
ocx-schema-parser export path/to/OCX_Schema.xsd
# List schema entities as 'prefix:name', one per line
ocx-schema-parser list elements path/to/OCX_Schema.xsd
ocx-schema-parser list complex-types path/to/OCX_Schema.xsd
ocx-schema-parser list simple-types path/to/OCX_Schema.xsd
ocx-schema-parser list enumerations path/to/OCX_Schema.xsd
# Show one entity's documentation, attributes and children (case-insensitive)
ocx-schema-parser list elements path/to/OCX_Schema.xsd --name ocx:Vessel
# Print entity counts grouped by target namespace
ocx-schema-parser summary path/to/OCX_Schema.xsd
Python API
from ocx_schema_parser import load, resolve, DEFAULT_SCHEMA
schemas = load(DEFAULT_SCHEMA) # URL, local .xsd file, or folder
model = resolve(schemas) # -> OcxSchema (frozen Pydantic model)
vessel = model.get("ocx:Vessel")
print(vessel.description)
print([a.name for a in vessel.attributes])
print(model.model_dump_json(indent=2)) # full JSON export
# Attributes with inline enumerations reference their EnumType by prefixed
# name (e.g. "ocx:functionType", "unitsml:prefix"), so attribute types can
# be looked up in model.enumerations.
enums = {f"{e.prefix}:{e.name}": e for e in model.enumerations}
API documentation
Autogenerated with sphinx: https://ocxstandard.github.io/ocx-schema-parser/
Development
This project uses uv for environment and package management.
# Set up the environment
uv sync
# Install git hooks: linting on commit, full test suite on push
uv run pre-commit install
# Run the tests (with coverage)
uv run pytest
Releasing
- Add a section for the new version to
CHANGELOG.md(heading format:## [X.Y.Z] - YYYY-MM-DD). - Run
uv run tbump X.Y.Z— this bumps the version, commits, and pushes avX.Y.Ztag. - The tag triggers the publish workflow: tests → build → PyPI (trusted publishing) → GitHub Release with the CHANGELOG notes.
Changelog
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ocx_schema_parser-3.1.0.tar.gz.
File metadata
- Download URL: ocx_schema_parser-3.1.0.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f49fadb2b42d3fbc593a8f43941c27ff88767d5e9c57dcc0f7a773a31cdadaf8
|
|
| MD5 |
377dc870dc48261a7a446da4d9c59b35
|
|
| BLAKE2b-256 |
95e90abe77de03e90b548f898d4a5eb98dc84b76e7bbedd16777bd51efdc7ea6
|
Provenance
The following attestation bundles were made for ocx_schema_parser-3.1.0.tar.gz:
Publisher:
python-publish.yml on OCXStandard/ocx-schema-parser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ocx_schema_parser-3.1.0.tar.gz -
Subject digest:
f49fadb2b42d3fbc593a8f43941c27ff88767d5e9c57dcc0f7a773a31cdadaf8 - Sigstore transparency entry: 2749727351
- Sigstore integration time:
-
Permalink:
OCXStandard/ocx-schema-parser@aecef6ad0a6b606691a7fd402cc0ab2317d3edcc -
Branch / Tag:
refs/tags/v3.1.0 - Owner: https://github.com/OCXStandard
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@aecef6ad0a6b606691a7fd402cc0ab2317d3edcc -
Trigger Event:
push
-
Statement type:
File details
Details for the file ocx_schema_parser-3.1.0-py3-none-any.whl.
File metadata
- Download URL: ocx_schema_parser-3.1.0-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
657789d371b1a928dd9a0d6ec721e161e2b45d69244199543f0d044c5b1d5bfe
|
|
| MD5 |
77f952dca9a0224c00d12d0a221d8c14
|
|
| BLAKE2b-256 |
8f235f6cf41d66d3412e191e550f8f5f41b23f9a3b505c669f117a4c2ac816ba
|
Provenance
The following attestation bundles were made for ocx_schema_parser-3.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on OCXStandard/ocx-schema-parser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ocx_schema_parser-3.1.0-py3-none-any.whl -
Subject digest:
657789d371b1a928dd9a0d6ec721e161e2b45d69244199543f0d044c5b1d5bfe - Sigstore transparency entry: 2749727389
- Sigstore integration time:
-
Permalink:
OCXStandard/ocx-schema-parser@aecef6ad0a6b606691a7fd402cc0ab2317d3edcc -
Branch / Tag:
refs/tags/v3.1.0 - Owner: https://github.com/OCXStandard
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@aecef6ad0a6b606691a7fd402cc0ab2317d3edcc -
Trigger Event:
push
-
Statement type: