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

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.1.0.tar.gz (23.7 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.1.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

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

Hashes for ocx_schema_parser-3.1.0.tar.gz
Algorithm Hash digest
SHA256 f49fadb2b42d3fbc593a8f43941c27ff88767d5e9c57dcc0f7a773a31cdadaf8
MD5 377dc870dc48261a7a446da4d9c59b35
BLAKE2b-256 95e90abe77de03e90b548f898d4a5eb98dc84b76e7bbedd16777bd51efdc7ea6

See more details on using hashes here.

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

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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ocx_schema_parser-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 657789d371b1a928dd9a0d6ec721e161e2b45d69244199543f0d044c5b1d5bfe
MD5 77f952dca9a0224c00d12d0a221d8c14
BLAKE2b-256 8f235f6cf41d66d3412e191e550f8f5f41b23f9a3b505c669f117a4c2ac816ba

See more details on using hashes here.

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

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

Release history Release notifications | RSS feed

This release

3.1.0 This release

2 files

3.0.0

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