pub struct RuleSet { /* private fields */ }Expand description
A rule set, as described by the manifest of its bundle: its name and version, the XML schema to validate against first, the stylesheets to run, in order, and the resources they read, with their checksums.
Implementations§
Source§impl RuleSet
impl RuleSet
Sourcepub fn parse(manifest: &str) -> Result<Self, Error>
pub fn parse(manifest: &str) -> Result<Self, Error>
Parses a bundle manifest (see the crate documentation for the format).
§Errors
Error::Bundle naming the line: a syntax outside the accepted TOML subset, an
unknown or repeated key, a missing key, a value that is not valid for its key, an
unknown schema, a format other than 1 and MANIFEST_FORMAT, a [[resource]],
a [[scenario]], an unflagged-assert or an unchecked-schema in format 1, a
path given twice, a scenario named twice, with a match expression that is not
XPath or uses a prefix it does not bind, naming a stylesheet the rule set does not
have (or one twice), with a match expression in some scenarios and not in others;
a scenario without one for a root element other than a UBL Invoice or
CreditNote or a CII CrossIndustryInvoice, or without a rule id; a scenario
giving a rule id two severities. Error::Unsupported for a match expression
outside the XPath subset of the engine.
Sourcepub fn builtin(name: &str) -> Result<Self, Error>
pub fn builtin(name: &str) -> Result<Self, Error>
The manifest of the built-in rule set name (see
BUILTIN_RULE_SETS), without loading it.
§Errors
Error::Bundle for an unknown name.
Sourcepub const fn schema(&self) -> Option<SchemaId>
pub const fn schema(&self) -> Option<SchemaId>
The XML schema documents are validated against first, if any.
Sourcepub fn unchecked_schema(&self) -> Option<&str>
pub fn unchecked_schema(&self) -> Option<&str>
The XML schema that the reference validator of the rule set also validates
documents against and that this rule set does not (format 2, unchecked-schema),
as the manifest names it: a gap in its verdicts, which reports state.
Sourcepub fn stylesheets(&self) -> &[StylesheetEntry]
pub fn stylesheets(&self) -> &[StylesheetEntry]
The stylesheets, in the order of the manifest: the order they run in, unless the
scenario a document matches orders them (Scenario::stylesheets).
Sourcepub fn resources(&self) -> &[ResourceEntry]
pub fn resources(&self) -> &[ResourceEntry]
The resources the stylesheets read with document() (format 2), in the order of
the manifest.
Sourcepub fn scenarios(&self) -> &[Scenario]
pub fn scenarios(&self) -> &[Scenario]
The scenarios (format 2), in the order of the manifest, which is the order they are tried in.
Sourcepub fn selects_by_scenario(&self) -> bool
pub fn selects_by_scenario(&self) -> bool
Whether the rule set selects by scenario: its scenarios have match expressions,
so that a document must match exactly one of them, which gives the stylesheets
that run on it and the severities of its rule ids; a document that matches none,
or more than one, is invalid, and no stylesheet runs on it (see Scenario).