Package pyxb :: Package binding :: Module content :: Class ContentState_mixin
[hide private]
[frames] | no frames]

Class ContentState_mixin

source code

object --+    
         |    
   cscRoot --+
             |
            ContentState_mixin
Known Subclasses:

Declares methods used by classes that hold state while validating a content model component.

Instance Methods [hide private]
 
accepts(self, particle_state, instance, value, element_use)
Determine whether the provided value can be added to the instance without violating state validation.
source code
 
notifyFailure(self, sub_state, particle_ok)
Invoked by a sub-state to indicate that validation cannot proceed in the current state.
source code
 
_verifyComplete(self, parent_particle_state)
Determine whether the deep state is complete without further elements.
source code

Inherited from cscRoot: __init__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

accepts(self, particle_state, instance, value, element_use)

source code 

Determine whether the provided value can be added to the instance without violating state validation.

This method must not throw any non-catastrophic exceptions; general failures should be transformed to a False return value.

Parameters:
  • particle_state - The ParticleState instance serving as the parent to this state. The implementation must inform that state when the proposed value completes the content model.
  • instance - An instance of a subclass of {basis.complexTypeDefinition}, into which the provided value will be stored if it is consistent with the current model state.
  • value - The value that is being validated against the state.
  • element_use - An optional ElementUse instance that specifies the element to which the value corresponds. This will be available when the value is extracted by parsing a document, but will be absent if the value was passed as a constructor positional parameter.
Returns:
True if the value was successfully matched against the state. False if the value did not match against the state.

notifyFailure(self, sub_state, particle_ok)

source code 

Invoked by a sub-state to indicate that validation cannot proceed in the current state.

Normally this is used when an intermediate content model must reset itself to permit alternative models to be evaluated.

Parameters:
  • sub_state - the state that was unable to accept a value
  • particle_ok - True if the particle that rejected the value is in an accepting terminal state

_verifyComplete(self, parent_particle_state)

source code 

Determine whether the deep state is complete without further elements.

No-op for non-aggregate state. For aggregate state, all contained particles should be checked to see whether the overall model can be satisfied if no additional elements are provided.

This method does not have a meaningful return value; violations of the content model should produce the corresponding exception (generally, MissingContentError).

Parameters:
  • parent_particle_state - the ParticleState for which this state is the term.