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

Class ContentModel

source code

object --+    
         |    
   cscRoot --+
             |
            ContentModel

The ContentModel is a deterministic finite state automaton which can be traversed using a sequence of DOM nodes which are matched on transitions against the legal content model of a complex type.

Instance Methods [hide private]
 
__init__(self, state_map=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
initialDFAStack(self) source code
 
step(self, ctd_instance, state, value, element_use, dfa_stack)
Perform a single step in the content model.
source code
 
isFinal(self, state) source code
 
allowsEpsilonTransitionToFinal(self) source code
 
validate(self, available_symbols, succeed_at_dead_end=False)
Determine whether this content model can be satisfied using the provided elements.
source code

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

Class Variables [hide private]
  __stateMap = None
  __InitialState = 1
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, state_map=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

step(self, ctd_instance, state, value, element_use, dfa_stack)

source code 

Perform a single step in the content model. This is a pass-through to ContentModelState.evaluateContent for the appropriate state.

Parameters:
  • state (int) - The starting state in this content model.

validate(self, available_symbols, succeed_at_dead_end=False)

source code 

Determine whether this content model can be satisfied using the provided elements.

The general idea is to treat the transitions of the DFA as symbols in an alphabet. For each such transition, a sequence of values is provided to be associated with the transition. One transition is permitted for each value associated with the symbol. The symbol (key) None represents wildcard values.

If a path is found that uses every symbol in valid transitions and ends in a final state, the return value is a pair consisting of the unconsumed symbols and a sequence of term, value pairs that define the acceptable path. If no valid path through the DFA can be taken, None is returned.

Parameters:
  • available_symbols - A map from leaf DFA terms to a sequence of values associated with the term in a binding instance. The key None is used to represent wildcard elements. If a key appears in this map, it must have at least one value in its sequence.
  • succeed_at_dead_end - If True, states from which no transition can be made are accepted as final states. This is used when processing "all" model groups, where the content model for the current alternative must succeed while retaining the symbols that are needed for other alternatives.