summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter A. Bigot <pabigot@users.sourceforge.net>2010-05-29 11:08:28 -0500
committerPeter A. Bigot <pabigot@users.sourceforge.net>2010-05-29 11:08:28 -0500
commit31de06b51c0cf1cac416d42dba52cbe5863d8585 (patch)
tree3be427ebcc8cc9b3956312a16548796af8e0e014
parentad80fe8e7e1846906b838aaefafa3ea9c3995e42 (diff)
Prefer post-DOM validation when content came from DOM
-rw-r--r--pyxb/binding/basis.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/pyxb/binding/basis.py b/pyxb/binding/basis.py
index 4b5cf99..9309620 100644
--- a/pyxb/binding/basis.py
+++ b/pyxb/binding/basis.py
@@ -396,6 +396,10 @@ class _TypeBinding_mixin (utility.Locatable_mixin):
self._validateBinding_vx()
return True
+ def _postDOMValidate (self):
+ self.validateBinding()
+ return self
+
@classmethod
def _Name (cls):
if cls._ExpandedName is not None:
@@ -1484,9 +1488,7 @@ class element (utility._DeconflictSymbols_mixin, _DynamicCreate_mixin):
rv = type_class.Factory(_dom_node=node, _fallback_namespace=fallback_namespace, **kw)
assert rv._element() == element_binding
rv._setNamespaceContext(ns_ctx)
- if pyxb._ParsingRequiresValid:
- rv.validateBinding()
- return rv
+ return rv._postDOMValidate()
def __str__ (self):
return 'Element %s' % (self.name(),)
@@ -2104,13 +2106,16 @@ class complexTypeDefinition (_TypeBinding_mixin, utility._DeconflictSymbols_mixi
def _IsMixed (cls):
return (cls._CT_MIXED == cls._ContentTypeTag)
+ def _postDOMValidate (self):
+ if self._PerformValidation() and (not self._isNil()) and (self.__stateStack is not None):
+ self.__stateStack.verifyComplete()
+ return self
+
def _setContentFromDOM (self, node, _fallback_namespace):
"""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):
- self.__stateStack.verifyComplete()
- return self
+ return self._postDOMValidate()
def _setDOMFromAttributes (self, dom_support, element):
"""Add any appropriate attributes from this instance into the DOM element."""