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

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ocx_schema_parser-3.0.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ocx_schema_parser-3.0.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file ocx_schema_parser-3.0.0.tar.gz.

File metadata

  • Download URL: ocx_schema_parser-3.0.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ocx_schema_parser-3.0.0.tar.gz
Algorithm Hash digest
SHA256 c15f47442e08c1ce8a1e84b0c27ddc50e432c903732cc1badd373139551c10ae
MD5 e5cb1f0d10fb31dde19751d8694dcfd9
BLAKE2b-256 e8d79ce7d42869e5d05e814e270bc69652fadd630d6e5b1aed70953173a7a67a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocx_schema_parser-3.0.0.tar.gz:

Publisher: python-publish.yml on OCXStandard/ocx-schema-parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ocx_schema_parser-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ocx_schema_parser-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8830a5904f17705e16b3c189833c15f8dabc51df191126721f0bc1bf83a7b760
MD5 bbd60ca9bd052d43ca6fdf448b8aa38d
BLAKE2b-256 d9d8a97ca60af78062510dff927e6674942df8669d3a40e893fee3b9de024eb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocx_schema_parser-3.0.0-py3-none-any.whl:

Publisher: python-publish.yml on OCXStandard/ocx-schema-parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

3.1.0

2 files

This release

3.0.0 This release

2 files

2.0.1

2 files

1.8.5

2 files

1.8.0

2 files

1.7.1

2 files

1.6.0

2 files

1.5.2

2 files

1.4.0

2 files

1.3.1

2 files

1.0.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

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