pub enum ContentValidatorState {
Nfa {
nfa: NfaTable,
active_states: ActiveStates,
open_content: Option<OpenContentInfo>,
},
AllGroup {
model: AllGroupModel,
state: AllGroupState,
suffix_locked: bool,
},
AllGroupExtension {
model: AllGroupModel,
state: AllGroupState,
extension_nfa: NfaTable,
phase: AllGroupExtPhase,
},
Simple,
Empty,
}Expand description
Unified content model validation state
Wraps either an NFA-based or AllGroup-based content model into a single
enum so that SchemaValidator can advance the content model without
caring which underlying representation is in use.
Variants§
Nfa
NFA-based content model (sequence, choice, etc.)
AllGroup
All-group content model (unordered particles)
AllGroupExtension
All-group base + NFA extension (XSD 1.1 complex type extension).
Simple
Simple content (text only, no child elements)
Empty
Empty content (no children or text)
Implementations§
Source§impl ContentValidatorState
impl ContentValidatorState
Sourcepub fn from_matcher(matcher: ContentModelMatcher) -> Self
pub fn from_matcher(matcher: ContentModelMatcher) -> Self
Create a content validator state from a compiled content model matcher
Sourcepub fn from_nfa(nfa: NfaTable) -> Self
pub fn from_nfa(nfa: NfaTable) -> Self
Create a content validator state from an NFA table
Computes the initial epsilon closure from the start state.
Sourcepub fn from_all_group(model: AllGroupModel) -> Self
pub fn from_all_group(model: AllGroupModel) -> Self
Create a content validator state from an all-group model
Sourcepub fn advance_element(
&mut self,
name: NameId,
namespace: Option<NameId>,
target_ns: Option<NameId>,
xsd_version: XsdVersion,
subst_groups: Option<&SubstitutionGroupMap>,
) -> Option<ElementMatchInfo>
pub fn advance_element( &mut self, name: NameId, namespace: Option<NameId>, target_ns: Option<NameId>, xsd_version: XsdVersion, subst_groups: Option<&SubstitutionGroupMap>, ) -> Option<ElementMatchInfo>
Advance the content model with a child element
Returns None if the element was rejected.
Returns Some(ElementMatchInfo) if accepted, containing the
ElementKey and resolved_type from the matching NFA term (if any).
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check whether the content model is in a complete (accepting) state
For NFA: any active state is the accept state. For AllGroup: all required particles have been satisfied.
Sourcepub fn would_accept(
&self,
name: NameId,
namespace: Option<NameId>,
target_ns: Option<NameId>,
xsd_version: XsdVersion,
subst_groups: Option<&SubstitutionGroupMap>,
) -> bool
pub fn would_accept( &self, name: NameId, namespace: Option<NameId>, target_ns: Option<NameId>, xsd_version: XsdVersion, subst_groups: Option<&SubstitutionGroupMap>, ) -> bool
Non-mutating lookahead: would the given element be accepted?
This does not change the state of the content model.
Trait Implementations§
Source§impl Clone for ContentValidatorState
impl Clone for ContentValidatorState
Source§fn clone(&self) -> ContentValidatorState
fn clone(&self) -> ContentValidatorState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more