Commits

Jason Pellerin committed 585dc41

Fixed handling of elements without contained types?

Comments (0)

Files changed (1)

 
     def _build_type(self, t, client):
         parent = None
+        force_name = None
         name = t.get('name', None)
         if name is None:
             return
-        typel = t.find('{%s}complexType' % NS_XSD)
-        if typel is None:
-            typel = t.find('{%s}simpleType' % NS_XSD)
-        force_name = False
-        if typel is not None:
+        if self._is_element(t):
+            typel = t.find('{%s}complexType' % NS_XSD)
+            if typel is None:
+                typel = t.find('{%s}simpleType' % NS_XSD)
+            if typel is None:
+                return # FIXME element.type ?
+            force_name = False
             # this case looks like:
             # <xs:element name="XXX"><xs:complexType>...
             # name and other attribs are in parent (t) but
     def _is_simple(self, element):
         return element.tag == self._simple_tag
 
+    def _is_element(self, element):
+        return local(element.tag) == 'element'
+
     def _any_abstract(self, bases):
         for cls in bases:
             if getattr(cls, '_abstract', None):