Skip to main content

ParseError

Enum ParseError 

Source
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.

Fields

§position: Position
§

NoPatterns

The schema contains no <pattern> elements.

§

MissingAttribute

A required attribute is missing on an element.

Fields

§element: &'static str
§attribute: &'static str
§position: Position
§

UnknownAbstractPattern

<pattern is-a="..."> referenced a pattern id with no matching <pattern abstract="true" id="..."> in the schema.

Fields

§pattern: String
§position: Position
§

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).

Fields

§rule: String
§position: Position
§

CyclicRuleExtends

<extends> formed a cycle (a rule extending itself, directly or transitively).

Fields

§rule: String
§position: Position
§

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.

Fields

§element: String
§position: Position
§

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).

Fields

§element: &'static str
§position: Position
§

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).

Fields

§pattern: String
§position: Position
§

UnknownDiagnosticReference

assert|report/@diagnostics referenced a diagnostic id with no matching <diagnostic id="..."> in the schema.

Fields

§position: Position
§

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.

Fields

§binding: String
§position: Position
§

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.

Fields

§href: String
§position: Position
§

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.

Fields

§href: String
§message: String
§position: Position
§

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”).

Fields

§href: String
§reason: &'static str
§position: Position

Trait Implementations§

Source§

impl Clone for ParseError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ParseError

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ParseError

Source§

impl Error for ParseError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for ParseError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ParseError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.