#NEWLINE# def process_element( elements , element_name , node , element_type , xsd_uri , dialect , namespace , qualified = None , soapenc_uri = 'http://schemas.xmlsoap.org/soap/encoding/' ) : #NEWLINE# #INDENT# 'Parse and define simple element types' #NEWLINE# log . debug ( ( 'Processing element %s %s' % ( element_name , element_type ) ) ) #NEWLINE# for tag in node : #NEWLINE# #INDENT# if ( tag . get_local_name ( ) in ( 'annotation' , 'documentation' ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( tag . get_local_name ( ) in ( 'element' , 'restriction' ) ) : #NEWLINE# #INDENT# log . debug ( ( '%s has no children! %s' % ( element_name , tag ) ) ) #NEWLINE# children = tag #NEWLINE# alias = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if tag . children ( ) : #NEWLINE# #INDENT# children = tag . children ( ) #NEWLINE# alias = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . debug ( ( '%s has no children! %s' % ( element_name , tag ) ) ) #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# d = OrderedDict ( ) #NEWLINE# d . namespace = namespace #NEWLINE# d . qualified = qualified #NEWLINE# for e in children : #NEWLINE# #INDENT# t = e [ 'type' ] #NEWLINE# if ( not t ) : #NEWLINE# #INDENT# t = e [ 'base' ] #NEWLINE# #UNINDENT# if ( not t ) : #NEWLINE# #INDENT# t = e [ 'ref' ] #NEWLINE# #UNINDENT# if ( not t ) : #NEWLINE# #INDENT# if ( e [ 'name' ] and e . children ( ) ) : #NEWLINE# #INDENT# t = ( '%s_%s' % ( element_name , e [ 'name' ] ) ) #NEWLINE# c = e . children ( ) #NEWLINE# et = c . get_local_name ( ) #NEWLINE# c = c . children ( ) #NEWLINE# process_element ( elements , t , c , et , xsd_uri , dialect , namespace , qualified ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# t = 'anyType' #NEWLINE# #UNINDENT# #UNINDENT# t = t . split ( ':' ) #NEWLINE# if ( len ( t ) > 1 ) : #NEWLINE# #INDENT# ( ns , type_name ) = t #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( ns , type_name ) = ( None , t [ 0 ] ) #NEWLINE# #UNINDENT# if ( ( element_name == type_name ) and ( not alias ) and ( len ( children ) > 1 ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# uri = ( ( ns and e . get_namespace_uri ( ns ) ) or xsd_uri ) #NEWLINE# if ( ( uri in ( xsd_uri , soapenc_uri ) ) and ( type_name != 'Array' ) ) : #NEWLINE# #INDENT# fn = REVERSE_TYPE_MAP . get ( type_name , None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( uri == soapenc_uri ) and ( type_name == 'Array' ) ) : #NEWLINE# #INDENT# fn = [ ] #NEWLINE# for a in e . children ( ) : #NEWLINE# #INDENT# for ( k , v ) in a [ : ] : #NEWLINE# #INDENT# if k . endswith ( ':arrayType' ) : #NEWLINE# #INDENT# type_name = v #NEWLINE# if ( ':' in type_name ) : #NEWLINE# #INDENT# type_name = type_name [ ( type_name . index ( ':' ) + 1 ) : ] #NEWLINE# #UNINDENT# if ( '[]' in type_name ) : #NEWLINE# #INDENT# type_name = type_name [ : type_name . index ( '[]' ) ] #NEWLINE# #UNINDENT# fn . append ( REVERSE_TYPE_MAP . get ( type_name , None ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# fn = None #NEWLINE# #UNINDENT# #UNINDENT# if ( not fn ) : #NEWLINE# #INDENT# if ns : #NEWLINE# #INDENT# fn_namespace = uri #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fn_namespace = namespace #NEWLINE# #UNINDENT# for ( k , v ) in e [ : ] : #NEWLINE# #INDENT# if k . startswith ( 'xmlns:' ) : #NEWLINE# #INDENT# fn_namespace = v #NEWLINE# #UNINDENT# #UNINDENT# fn = elements . setdefault ( make_key ( type_name , 'complexType' , fn_namespace ) , OrderedDict ( ) ) #NEWLINE# #UNINDENT# if ( ( e [ 'maxOccurs' ] == 'unbounded' ) or ( ( uri == soapenc_uri ) and ( type_name == 'Array' ) ) ) : #NEWLINE# #INDENT# if isinstance ( fn , OrderedDict ) : #NEWLINE# #INDENT# if ( ( len ( children ) > 1 ) and ( dialect in ( 'jetty' , ) ) ) : #NEWLINE# #INDENT# fn . array = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# d . array = True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( dialect in ( 'jetty' , ) ) : #NEWLINE# #INDENT# fn = [ fn ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# d . array = True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( ( ( e [ 'name' ] is not None ) and ( not alias ) ) or e [ 'ref' ] ) : #NEWLINE# #INDENT# e_name = ( e [ 'name' ] or type_name ) #NEWLINE# d [ e_name ] = fn #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . debug ( ( 'complexContent/simpleType/element %s = %s' % ( element_name , type_name ) ) ) #NEWLINE# d [ None ] = fn #NEWLINE# #UNINDENT# if ( ( e is not None ) and ( e . get_local_name ( ) == 'extension' ) and e . children ( ) ) : #NEWLINE# #INDENT# process_element ( elements , element_name , e . children ( ) , element_type , xsd_uri , dialect , namespace , qualified ) #NEWLINE# #UNINDENT# #UNINDENT# elements . setdefault ( make_key ( element_name , element_type , namespace ) , OrderedDict ( ) ) . update ( d )