pyxsd.schematron.errors¶
Schematron exception contracts.
Compilation findings and instance validity stay separate: a malformed,
unsupported, or unreadable schema raises a compile error, and an exhausted
budget raises a limit error, while only a failed assertion makes an instance
invalid. Every exception derives from pyxsd.exceptions.PyXSDError,
so callers may catch either the specific contract or the common family.
Exceptions¶
Base class for every fatal Schematron failure. |
|
A source could not become a Schematron schema. |
|
A validation-time expression, function, key, or document operation failed. |
|
A configured Schematron budget was exhausted. |
Module Contents¶
- exception pyxsd.schematron.errors.SchematronError¶
Base class for every fatal Schematron failure.
- exception pyxsd.schematron.errors.SchematronCompileError(message, *, location=None)¶
A source could not become a Schematron schema.
locationnames the exact source occurrence when the failure has one; a well-formedness failure reported by the XML parser has no element occurrence and therefore no location. The rendered message includes the source name, and a known element occurrence adds its line and column.- Parameters:
message (str)
location (pyxsd.locations.IssueLocation | None)
- property location: pyxsd.locations.IssueLocation | None¶
The source occurrence where the failure was detected, when known.
- Return type:
- exception pyxsd.schematron.errors.SchematronEvaluationError(message, *, location=None, schema_location=None, pattern_id=None, rule_id=None, check_id=None, code=None, cause=None, stage=None, document_uri=None, outer_context=None, visited_ordinal=None, visited_item=None)¶
A validation-time expression, function, key, or document operation failed.
This is an operational failure, never a failed assertion and never a successful report.
locationnames the instance occurrence being evaluated,schema_locationthe responsible rule, check, or variable declaration, andpattern_id/rule_id/check_ididentify the producing definitions when the failure has them.document_uriis the URI of the instance document that ownslocation, orNonewhen the instance was parsed without one; it is never substituted from the primary document when a visited subordinate supplied the location.stagenames the work that failed ("parameters","let","visit-each","phase","when","from","context","check","subject","message","diagnostic","property","flag","role","severity", or"documents"),codepreserves the original XSLT/XPath error code, andcauseretains the original exception. A resource policy’s refusal of a subordinatedoc()/document()read is such a failure at any of those stages:causeis thatResourcePolicyErrorandcodeisNonebecause no XSLT or XPath error occurred.outer_contextis the structured occurrence of the outer matched rule context, independent of wherelocationpoints.visited_ordinalandvisited_itemretain a 2025@visit-eachfailure’s item position and bounded display text; they areNonewhen no visited item was in force.visited_itemis a display value, not a parsed message field: rewriting the rendered message can never change the structured identity. The explicitsvrl:errorserializer readsdocument_uri,location, andcodedirectly.outer_contextand the visited fields are typed native identity used to choose the authoritative location; SVRL has no separate slots for them, so its one@location/rich-text pair represents that limit rather than duplicating or reparsing the identities.- Parameters:
message (str)
location (pyxsd.locations.IssueLocation | None)
schema_location (pyxsd.locations.IssueLocation | None)
pattern_id (str | None)
rule_id (str | None)
check_id (str | None)
code (str | None)
cause (BaseException | None)
stage (str | None)
document_uri (str | None)
outer_context (pyxsd.locations.IssueLocation | None)
visited_ordinal (int | None)
visited_item (str | None)
- location = None¶
- schema_location = None¶
- pattern_id = None¶
- rule_id = None¶
- check_id = None¶
- code = None¶
- cause = None¶
- stage = None¶
- document_uri = None¶
- outer_context = None¶
- visited_ordinal = None¶
- visited_item = None¶
- exception pyxsd.schematron.errors.SchematronLimitError(stage, budget, configured, observed)¶
A configured Schematron budget was exhausted.
Budget exhaustion is not semantic invalidity: the schema or instance that exceeds a caller’s budget has no verdict. A budget is an inclusive bound, so observing exactly the configured value succeeds and the next unit of work raises.
stagenames the compiler or validator stage,budgetthe limit field,configuredthe caller’s value, andobservedthe count that crossed it.