pub struct Scenario { /* private fields */ }Expand description
A scenario of the rule set (format 2, [[scenario]]): which documents it matches, the
severities it gives rule ids, whatever their flags, in them (the customLevel
elements of a scenario of a KoSIT validator configuration), and, for a scenario with
a match expression, the stylesheets that run on them.
A scenario matches documents in one of two ways, the same for every scenario of a manifest:
- With a
matchexpression (Scenario::match_expression), the XPath expression of a KoSIT scenario, evaluated as the KoSIT validator evaluates it: its effective boolean value, the document node as the context item, the prefixes ofScenario::namespacesbound. The rule set then selects by scenario (RuleSet::selects_by_scenario): a document must match exactly one scenario, whose stylesheets run on it (Scenario::stylesheets); a document that matches none, or more than one, is invalid and no stylesheet runs on it, as the KoSIT validator rejects it with its fallback scenario. - With a root element and a specification identifier (
Scenario::namespace,Scenario::root,Scenario::identifier): a document matches when its root element has the scenario’s namespace and local name, and its specification identifier (BT-24) is the scenario’s: the string value of acbc:CustomizationIDchild of the root of a UBL document, or ofrsm:ExchangedDocumentContext/ram:GuidelineSpecifiedDocumentContextParameter/ram:IDin a CII document, compared as it is written. The first scenario of the manifest that matches gives its severities; every stylesheet runs, whether one matches or not.
Implementations§
Source§impl Scenario
impl Scenario
Sourcepub fn match_expression(&self) -> Option<&str>
pub fn match_expression(&self) -> Option<&str>
The match expression, for a scenario that has one: XPath, evaluated on the
document node.
Sourcepub fn namespaces(&self) -> &[(String, String)]
pub fn namespaces(&self) -> &[(String, String)]
The namespace prefixes the match expression may use, with their URIs, in the
order of the manifest; empty for a scenario without a match expression.
Sourcepub fn stylesheets(&self) -> Option<&[String]>
pub fn stylesheets(&self) -> Option<&[String]>
The names of the stylesheets that run on the documents it matches, in the order
they run, for a scenario with a match expression that names them; None when
every stylesheet of the rule set runs, in its order.
Sourcepub fn namespace(&self) -> Option<&str>
pub fn namespace(&self) -> Option<&str>
The namespace of the root element of the documents it matches, for a scenario
without a match expression.
Sourcepub fn root(&self) -> Option<&str>
pub fn root(&self) -> Option<&str>
The local name of the root element of the documents it matches (Invoice), for a
scenario without a match expression.
Sourcepub fn identifier(&self) -> Option<&str>
pub fn identifier(&self) -> Option<&str>
The specification identifier (BT-24) of the documents it matches, for a scenario
without a match expression.