Reference
loader
Load OCX schemas from a local file, folder, or remote URL into xsdata Schema objects.
- ocx_schema_parser.loader.load(source, download_folder=None)[source]
Load
sourceand return one parsedxsd.Schemaper XSD file.- Parameters:
source – A local
.xsdfile, a folder of.xsdfiles, or an http(s) URL.download_folder – Where remote schemas are downloaded. Defaults to a temporary folder. The folder is cleared before downloading.
- Raises:
OcxParserError – If the source is missing, empty, or fails to parse.
- Return type:
list[Schema]
resolver
- ocx_schema_parser.resolver.resolve(schemas)[source]
Resolve parsed schemas into the immutable OcxSchema model.
- Raises:
OcxParserError – If
schemasis empty.- Return type:
model
Typed, immutable data model of a resolved OCX schema (Pydantic v2).
- class ocx_schema_parser.model.Attribute(**data)[source]
Bases:
FrozenModelA resolved XML attribute of a global element or complex type.
- default: Optional[str]
- description: str
- fixed: Optional[str]
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- prefix: str
- type: str
- use: Literal['required', 'optional']
- class ocx_schema_parser.model.Cardinality(**data)[source]
Bases:
FrozenModelOccurrence bounds of an element.
upper=Nonemeans unbounded.- lower: int
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- upper: Optional[int]
- class ocx_schema_parser.model.ChildElement(**data)[source]
Bases:
FrozenModelA resolved child element (particle) of a global element or complex type.
- cardinality: Cardinality
- description: str
- from_substitution_group: Optional[str]
- inherited_from: Optional[str]
- is_choice: bool
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- prefix: str
- type: str
- class ocx_schema_parser.model.ComplexType(**data)[source]
Bases:
FrozenModelA named complex type declared in the schema.
- abstract: bool
- attributes: list[Attribute]
- children: list[ChildElement]
- description: str
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- parents: list[str]
- prefix: str
- tag: str
- class ocx_schema_parser.model.EnumType(**data)[source]
Bases:
FrozenModelA simple type restricted to an enumeration.
- description: str
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- prefix: str
- tag: str
- values: list[EnumValue]
- class ocx_schema_parser.model.EnumValue(**data)[source]
Bases:
FrozenModelOne enumeration facet value.
- description: str
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- value: str
- class ocx_schema_parser.model.FrozenModel(**data)[source]
Bases:
BaseModelBase model: immutable after construction.
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ocx_schema_parser.model.GlobalElement(**data)[source]
Bases:
FrozenModelA global element declaration with its fully flattened content model.
- abstract: bool
- attributes: list[Attribute]
- cardinality: Cardinality
- children: list[ChildElement]
- description: str
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- parents: list[str]
- prefix: str
- substitution_group: Optional[str]
- tag: str
- type: str
- class ocx_schema_parser.model.OcxSchema(**data)[source]
Bases:
FrozenModelThe fully resolved OCX schema.
- attribute_groups: dict[str, list[Attribute]]
- complex_types: list[ComplexType]
- elements: list[GlobalElement]
- enumerations: list[EnumType]
- get(name)[source]
Look up a global element by
nameorprefix:name.- Return type:
Optional[GlobalElement]
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- namespaces: dict[str, str]
- schema_changes: list[SchemaChange]
- schema_version: str
- simple_types: list[SimpleType]
- substitution_groups: dict[str, list[str]]
- target_namespace: str
- class ocx_schema_parser.model.SchemaChange(**data)[source]
Bases:
FrozenModelA SchemaChange appinfo record.
- author: str
- date: str
- description: str
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- version: str
- class ocx_schema_parser.model.SimpleType(**data)[source]
Bases:
FrozenModelA non-enumeration simple type with its restriction facets.
- base: str
- description: str
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- prefix: str
- restriction: dict[str, str]
- tag: str
downloader
- class ocx_schema_parser.downloader.SchemaDownloader(output)[source]
Bases:
DownloaderDownloader specialisation: writes all referenced schemas into one folder.
- Parameters:
output – The path to the schema download folder.
- wget(uri, location=None)[source]
Download
uri(remote URI or local file path) with circular protection.- Raises:
OcxParserError – If the source cannot be fetched or parsed.
cli
Command line interface: export the OCX schema model as JSON or list its entities.