pyxsd.relaxng.introspection¶
Immutable RELAX NG grammar inventories, stable IDs, and dependency traversal.
The described object is the compiled semantic graph, not the authored syntax.
Composition binds every reference and names the surviving element definitions
with deterministic, composer-generated keys (element0, element1, …);
an authored define name therefore does not appear in the inventory. Every
definition component is marked RelaxNGComponentDescription.synthetic
and its origins retain the authored evidence that produced it.
Component IDs cover normalized grammar semantics and dependency-content identities, never source paths, object addresses, process hash seeds, or mapping insertion order. Locations and origins are evidence beside those identities: relocating or recompiling identical resource content changes locations, not IDs. Name classes use a canonical, alternative-ordered presentation. Every pattern component, including an interior shared by a legal reference cycle, has a structural identity. Route components use the projection planner’s route ID directly.
Classes¶
One immutable component of a compiled RELAX NG grammar. |
|
A deterministic grammar inventory. |
Functions¶
|
Return the immutable grammar inventory, valid schema or not. |
|
Return one exact component, raising |
|
Filter by literal case-insensitive text, component kind, and namespace. |
|
Breadth-first component traversal, excluding the seed and duplicates. |
Module Contents¶
- class pyxsd.relaxng.introspection.RelaxNGComponentDescription¶
One immutable component of a compiled RELAX NG grammar.
kindisgrammar,define,pattern,name-class,datatype,route, orresource.namespaceis an expanded-name namespace only (never a datatype-library URI).nameis a local name for exact element/attribute patterns and exact name classes, an expanded element name for routes, a datatype type name for datatypes, and the first canonical resource ID for resources; otherwise it is absent. A definition’snameis the composer-generated key.syntheticis true only for these generated definitions, not for patterns or routes; authoreddefinenames survive only as origins.owner_idisNonefor the grammar and"grammar"for all other components: it denotes inventory ownership, not an authored parent.name_classis the canonical presentation of an element/attribute/route/name-class name class. Datatype components carry their normalized library, type, and ordered parameters. There are deliberately no XSD-only fields: noglobal_declaration, Python binding, occurrence count, or default. Origins union every contributing site. Location is the smallest origin by source ID then source/path/attribute, except resources: their location is the first sorted reference’s location (possibly absent), ordered by containing ID, reference, base, xml:base, canonical ID, then location.- location: pyxsd.locations.IssueLocation | None¶
- origins: pyxsd.relaxng.origins.OriginTable¶
- class pyxsd.relaxng.introspection.RelaxNGSchemaDescription¶
A deterministic grammar inventory.
start_idsnames the compiled start pattern component. Components are sorted by kind rank and then ID;dependenciesis the compilation’s canonical resource closure verbatim, including every dependency record whose content merges into one resource component.- components: tuple[RelaxNGComponentDescription, ...]¶
- pyxsd.relaxng.introspection.describe_schema(schema)¶
Return the immutable grammar inventory, valid schema or not.
An invalid compilation still exposes its grammar, start pattern, definitions, patterns, and resource dependencies. Projection routes are omitted without asking an invalid schema for
schema.projection; the report and its verdict are never changed.- Parameters:
schema (pyxsd.relaxng.schema.RelaxNGSchema)
- Return type:
- pyxsd.relaxng.introspection.describe_component(schema, component_id)¶
Return one exact component, raising
KeyErrorfor any other ID.- Parameters:
schema (pyxsd.relaxng.schema.RelaxNGSchema)
component_id (str)
- Return type:
- pyxsd.relaxng.introspection.find_components(schema, *, text=None, kind=None, namespace=None)¶
Filter by literal case-insensitive text, component kind, and namespace.
Noneleaves a filter unrestricted; an empty namespace selects components without an expanded-name namespace. Text is matched literally over the ID, name, namespace, pattern kind, canonical name class, and datatype library/type; no caller expression is evaluated.- Parameters:
schema (pyxsd.relaxng.schema.RelaxNGSchema)
text (str | None)
kind (str | None)
namespace (str | None)
- Return type:
Breadth-first component traversal, excluding the seed and duplicates.
- Parameters:
schema (pyxsd.relaxng.schema.RelaxNGSchema)
component_id (str)
direction (Literal['uses', 'used_by'])
depth (int)
- Return type: