def elements_nested(self): """List of tuples containing the element name and the element""" result = [] generator = NamePrefixGenerator() # Handle wsdl:arrayType objects if self._array_type: name = generator.get_name() if isinstance(self._element, Group): result = [ ( name, Sequence( [ Any( max_occurs="unbounded", restrict=self._array_type.array_type, ) ] ), ) ] else: result = [(name, self._element)] else: # _element is one of All, Choice, Group, Sequence if self._element: result.append((generator.get_name(), self._element)) return result
def elements_nested(self): """List of tuples containing the element name and the element""" result = [] generator = NamePrefixGenerator() # Handle wsdl:arrayType objects attrs = { attr.qname.text: attr for attr in self._attributes if attr.qname } array_type = attrs.get( '{http://schemas.xmlsoap.org/soap/encoding/}arrayType') if array_type: name = generator.get_name() if isinstance(self._element, Group): return [(name, Sequence([ Any(max_occurs='unbounded', restrict=array_type.array_type) ]))] else: return [(name, self._element)] # _element is one of All, Choice, Group, Sequence if self._element: result.append((generator.get_name(), self._element)) return result
def __init__(self, element=None, attributes=None, restriction=None, extension=None, qname=None, is_global=False): if element and type(element) == list: element = Sequence(element) self.name = self.__class__.__name__ if qname else None self._element = element self._attributes = attributes or [] self._restriction = restriction self._extension = extension self._extension_types = tuple() super(ComplexType, self).__init__(qname=qname, is_global=is_global)
def __init__( self, element=None, attributes=None, restriction=None, extension=None, qname=None, is_global: bool = False, ): if element and type(element) == list: element = Sequence(element) self.name = self.__class__.__name__ if qname else None self._element = element self._attributes = attributes or [] self._restriction = restriction self._extension = extension self._extension_types: typing.List[typing.Type] = [] super().__init__(qname=qname, is_global=is_global)