diff options
author | Peter A. Bigot <pabigot@users.sourceforge.net> | 2010-05-29 09:58:34 -0500 |
---|---|---|
committer | Peter A. Bigot <pabigot@users.sourceforge.net> | 2010-05-29 09:58:34 -0500 |
commit | e8487d57f9d3d161de17d907c145a58ab8ca1233 (patch) | |
tree | fcaed26a16a0911f56d96d7a2697697a7e74fc19 | |
parent | 6bc2b2210f6121442597f240d1601f596c200088 (diff) |
Use alternative post-assignment validation, remove unnecessary code
-rw-r--r-- | pyxb/binding/basis.py | 3 | ||||
-rw-r--r-- | pyxb/binding/content.py | 21 |
2 files changed, 1 insertions, 23 deletions
diff --git a/pyxb/binding/basis.py b/pyxb/binding/basis.py index b4fb68e..184ab9b 100644 --- a/pyxb/binding/basis.py +++ b/pyxb/binding/basis.py @@ -2107,8 +2107,7 @@ class complexTypeDefinition (_TypeBinding_mixin, utility._DeconflictSymbols_mixi """Initialize the content of this element from the content of the DOM node.""" self.extend(node.childNodes[:], _fallback_namespace) - if self._PerformValidation() and (not self._isNil()) and (self.__stateStack is not None) and (not self.__stateStack.isTerminal()): - raise pyxb.MissingContentError() + self.validateBinding() return self def _setDOMFromAttributes (self, dom_support, element): diff --git a/pyxb/binding/content.py b/pyxb/binding/content.py index 180cadf..89e72e4 100644 --- a/pyxb/binding/content.py +++ b/pyxb/binding/content.py @@ -102,14 +102,6 @@ class ContentState_mixin (pyxb.cscRoot): raise Exception('ContentState_mixin.notifyFailure not implemented in %s' % (type(self),)) - def isTerminalState (self): - """Indicate whether the content model is satisfied by the current state. - - The base implementation always returns C{True}, as a convenience to - non-aggregate state models. Aggregate state models need to override - this method.""" - return True - def _validate (self, symbol_set, output_sequence): raise Exception('ContentState_mixin._validate not implemented in %s' % (type(self),)) @@ -634,10 +626,6 @@ class SequenceState (ContentState_mixin): self.__parentParticleState.incrementCount() #print 'SS.NF %s: %d %s %s' % (self, self.__index, particle_ok, self.__particleState) - def isTerminalState (self): - print '%s check ts %s %d %s' % (self, self.__satisfied, self.__index, self.__particleState) - return self.__satisfied or (((1 + self.__index) == len(self.__particles)) and self.__particleState.isFinal()) - class ParticleState (pyxb.cscRoot): def __init__ (self, particle, parent_state=None): self.__particle = particle @@ -697,15 +685,6 @@ class ParticleState (pyxb.cscRoot): underflow_exc = pyxb.MissingElementError('too few') return (consumed, underflow_exc) - def isFinal (self): - print '%s isFinal %d %d %s' % (self, self.__particle.minOccurs(), self.__count, self.__particle.maxOccurs()) - print '%s term %s' % (self, self.__termState) - raise Exception() - return self.__particle.meetsMinimum(self.__count) and self.__particle.meetsMaximum(self.__count) - - def isTerminal (self): - return self.__termState.isTerminalState() and self.isFinal() - def __str__ (self): particle = self.__particle return 'ParticleState(%d:%d,%s:%s)@%x' % (self.__count, particle.minOccurs(), particle.maxOccurs(), particle.term(), id(self)) |