Skip to main content

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

  1. Add a section for the new version to CHANGELOG.md (heading format: ## [X.Y.Z] - YYYY-MM-DD).
  2. Run uv run tbump X.Y.Z — this bumps the version, commits, and pushes a vX.Y.Z tag.
  3. The tag triggers the publish workflow: tests → build → PyPI (trusted publishing) → GitHub Release with the CHANGELOG notes.

Changelog

Changelog

Metadata

Release files for ocx-schema-parser 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ocx-schema-parser 3.1.0
File Size Uploaded Provenance Actions
ocx_schema_parser-3.1.0.tar.gz 23.7 kB With provenance Details for ocx_schema_parser-3.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ocx-schema-parser 3.1.0
File Interpreter ABI Platform Actions
ocx_schema_parser-3.1.0-py3-none-any.whl Python 3 none any Details for ocx_schema_parser-3.1.0-py3-none-any.whl

Total release size: 41.8 kB

Release files / ocx_schema_parser-3.1.0.tar.gz

Download URL ocx_schema_parser-3.1.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f49fadb2b42d3fbc593a8f43941c27ff88767d5e9c57dcc0f7a773a31cdadaf8
BLAKE2b-256 checksum
How to use checksums
95e90abe77de03e90b548f898d4a5eb98dc84b76e7bbedd16777bd51efdc7ea6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release files / ocx_schema_parser-3.1.0-py3-none-any.whl

Download URL ocx_schema_parser-3.1.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
657789d371b1a928dd9a0d6ec721e161e2b45d69244199543f0d044c5b1d5bfe
BLAKE2b-256 checksum
How to use checksums
8f235f6cf41d66d3412e191e550f8f5f41b23f9a3b505c669f117a4c2ac816ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Security for ocx-schema-parser 3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ocx_schema_parser-3.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page