pub enum ParseError {
Show 15 variants
InvalidXml(String),
WrongRootNamespace {
found: Option<String>,
position: Position,
},
NoPatterns,
MissingAttribute {
element: &'static str,
attribute: &'static str,
position: Position,
},
UnknownAbstractPattern {
pattern: String,
position: Position,
},
UnknownRuleReference {
rule: String,
position: Position,
},
CyclicRuleExtends {
rule: String,
position: Position,
},
UnexpectedElement {
element: String,
position: Position,
},
DuplicateId {
element: &'static str,
id: String,
position: Position,
},
UnknownActivePattern {
pattern: String,
position: Position,
},
UnknownDiagnosticReference {
id: String,
position: Position,
},
UnsupportedQueryBinding {
binding: String,
position: Position,
},
CyclicInclude {
href: String,
position: Position,
},
UnresolvableInclude {
href: String,
message: String,
position: Position,
},
InvalidInclude {
href: String,
reason: &'static str,
position: Position,
},
}Expand description
An error encountered while parsing a Schematron schema.
Variants§
InvalidXml(String)
The input is not well-formed XML.
WrongRootNamespace
The root element is not <schema> in the Schematron namespace.
NoPatterns
The schema contains no <pattern> elements.
MissingAttribute
A required attribute is missing on an element.
UnknownAbstractPattern
<pattern is-a="..."> referenced a pattern id with no matching
<pattern abstract="true" id="..."> in the schema.
UnknownRuleReference
<extends rule="..."> referenced a rule id with no matching
<rule id="..."> in the same pattern (see
plan/07-abstract-patterns-and-extends.md for why the lookup is
pattern-local, not schema-wide).
CyclicRuleExtends
<extends> formed a cycle (a rule extending itself, directly or
transitively).
UnexpectedElement
A Schematron-namespace element appeared as a direct child of a
container it is not part of that container’s grammar — either a
typo of a known element (e.g. <asert>), or a real ISO Schematron
construct this crate does not implement (e.g. <include>). See
README.md’s support matrix. Foreign-namespace elements are never
affected — ISO’s own “foreign” content model already allows those
anywhere, regardless of this crate’s support.
DuplicateId
Two elements in the same ID space (pattern/@id or
diagnostic/@id) declared the same id — ambiguous for anything
that references it by IDREF(S) (active/@pattern,
assert|report/@diagnostics).
UnknownActivePattern
<active pattern="..."> referenced a pattern id with no matching
concrete <pattern id="..."> in the schema (abstract-pattern ids
don’t count — they never appear in Schema.patterns; compare
UnknownAbstractPattern, which is is-a’s own, separate reference
kind).
UnknownDiagnosticReference
assert|report/@diagnostics referenced a diagnostic id with no
matching <diagnostic id="..."> in the schema.
UnsupportedQueryBinding
schema/@queryBinding named a query language binding this crate
does not treat as equivalent to XPath 1.0 (issue #6) — evaluating
test/context/select expressions as XPath 1.0 anyway would
silently misinterpret a schema that explicitly opted into a
different query language (e.g. "xslt2", XPath 2.0). See
README.md’s support matrix for the accepted binding names.
CyclicInclude
crate::parse_with_resolver found an <include href="..."> it
had already started resolving further up the same inclusion chain
(issue #2) — A includes B includes A, directly or
transitively.
UnresolvableInclude
crate::parse_with_resolver’s SchemaResolver failed to
resolve an <include href="..."> (issue #2) — not found, not
readable, or disallowed by the resolver’s own policy; message is
the resolver’s crate::ResolveError, rendered.
InvalidInclude
An <include href="..."> (issue #2) resolved to content this
crate refuses to splice in: either the resolved root element isn’t
in the Schematron namespace at all, or it’s a whole <schema>
(the ISO reference implementation, iso_dsdl_include.xsl, treats
this the same way: “use include to include fragments, not a whole
schema”).
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
impl Eq for ParseError
Source§impl Error for ParseError
impl Error for ParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()