Skip to main content

ValidationRuntime

Struct ValidationRuntime 

Source
pub struct ValidationRuntime<'a, S: ValidationSink> {
    pub sink: S,
    /* private fields */
}
Expand description

Mutable per-run validation state.

Created by super::validator::SchemaValidator::start_run(). Holds the validation stack, identity constraint tables, sink, and all other per-run mutable state. The struct is explicitly !Send + !Sync.

Fields§

§sink: S

Sink for errors and warnings

Implementations§

Source§

impl<'a, S: ValidationSink> ValidationRuntime<'a, S>

Source

pub fn set_location(&mut self, location: SourceLocation)

Set the current source location for error reporting

Source

pub fn clear_location(&mut self)

Clear the current source location

Source

pub fn identity_constraint_tables( &self, ) -> Option<&HashMap<IdentityConstraintKey, KeyTable>>

Returns the final identity constraint tables after validation completes.

Only available after end_validation() succeeds. Contains key/unique/keyref tables accumulated during the root element’s validation scope.

Source

pub fn set_unparsed_entities(&mut self, entities: HashSet<String>)

Set the declared unparsed entity names from the document’s DTD.

When set, ENTITY/ENTITIES values are validated against this set per §3.16.4 String Valid clause 3: “Every ENTITY value in V is a declared entity name.”

Source

pub fn set_instance_base_uri(&mut self, base_uri: impl Into<String>)

Set the base URI of the instance document being validated.

This base URI is attached to every schema-location hint collected during validation so that relative URIs can be resolved correctly when schemas are loaded later.

Source

pub fn schema_location_hints(&self) -> &[SchemaLocationHint]

Returns accumulated xsi:schemaLocation hints.

Each hint contains a namespace/location pair plus the instance base URI for resolving relative locations. Complete pairs from every xsi:schemaLocation attribute are included, even from attributes that failed even-token-count enforcement (the complete pairs are still valid hints). Any trailing unpaired token is ignored.

Source

pub fn no_namespace_schema_location_hints( &self, ) -> &[NoNamespaceSchemaLocationHint]

Returns accumulated xsi:noNamespaceSchemaLocation hints.

Source

pub fn validate_element( &mut self, local_name: &str, namespace_uri: &str, xsi_type: Option<&str>, xsi_nil: Option<&str>, ns_context: &NamespaceContextSnapshot, ) -> SchemaInfo

Validate an element start event (string-based lookup)

local_name and namespace_uri identify the element. xsi_type is the value of xsi:type (if present), as a raw QName string. xsi_nil is the value of xsi:nil (if present). ns_context is used to resolve the xsi:type QName prefix.

Source

pub fn validate_element_by_id( &mut self, local_name: NameId, namespace: Option<NameId>, xsi_type: Option<&str>, xsi_nil: Option<&str>, ns_context: &NamespaceContextSnapshot, ) -> SchemaInfo

Validate an element start event (NameId fast-path)

Source

pub fn validate_attribute( &mut self, local_name: &str, namespace_uri: &str, value: &str, ) -> SchemaInfo

Validate an attribute (string-based lookup)

Source

pub fn validate_attribute_by_id( &mut self, local_name: NameId, namespace: Option<NameId>, value: &str, ) -> SchemaInfo

Validate an attribute (NameId fast-path)

Source

pub fn validate_end_of_attributes(&mut self) -> SchemaInfo

Signal end of attributes; checks for missing required attributes

Source

pub fn validate_text(&mut self, text: &str)

Validate a text content event

Source

pub fn validate_whitespace(&mut self, text: &str)

Validate a whitespace-only text event

Whitespace is always allowed in element-only content (it is insignificant).

Source

pub fn validate_end_element(&mut self) -> SchemaInfo

Validate an element end event

Source

pub fn end_validation(&mut self) -> Result<(), ValidationError>

Finalize validation

Checks that the validation stack is empty and performs IDREF validation.

Source

pub fn get_expected_elements(&self) -> Vec<ExpectedElement>

Get elements expected at the current position in the content model

Source

pub fn get_expected_attributes(&self) -> Vec<ExpectedAttribute>

Get attributes expected/allowed for the current element

Source

pub fn get_default_attributes(&self) -> Vec<DefaultAttribute>

Get default attributes that should be added to the current element

Source

pub fn get_inherited_attributes(&self) -> Vec<InheritedAttribute>

Get the [inherited attributes] PSVI property for the current element (XSD 1.1 §3.3.5.6, structures.html line 5200).

Returns the frozen incoming_inherited snapshot — ancestor-owned potentially-inherited attributes with nearest-owner shadowing. This is the spec’s [inherited attributes] property; it is NOT filtered by the element’s own [attributes].

Returns empty for skipped elements.

Source

pub fn content_processing(&self) -> ContentProcessing

Get the content processing mode for the current element

Source

pub fn take_deferred_attribute_results(&mut self) -> Vec<SchemaInfo>

Drain deferred attribute validation results collected during CTA processing.

Returns the SchemaInfo results in the same order as the attributes were originally encountered. The internal buffer is emptied.

Auto Trait Implementations§

§

impl<'a, S> !RefUnwindSafe for ValidationRuntime<'a, S>

§

impl<'a, S> !Send for ValidationRuntime<'a, S>

§

impl<'a, S> !Sync for ValidationRuntime<'a, S>

§

impl<'a, S> !UnwindSafe for ValidationRuntime<'a, S>

§

impl<'a, S> Freeze for ValidationRuntime<'a, S>
where S: Freeze,

§

impl<'a, S> Unpin for ValidationRuntime<'a, S>
where S: Unpin,

§

impl<'a, S> UnsafeUnpin for ValidationRuntime<'a, S>
where S: UnsafeUnpin,

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> ErasedDestructor for T
where T: 'static,

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> MaybeSendSync for T

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.