generates ofwhat content, minOccurs/maxOccurs facet generation.
        Dependency instance attribute:
            mgContent -- expected to be either a complex definition
                with model group content, a model group, or model group 
                content.  TODO: should only support the first two.
            localTypes -- produce local class definitions later
            tcListElements -- elements, local/global

def _setTypecodeList(self):
        """generates ofwhat content, minOccurs/maxOccurs facet generation.
        Dependency instance attribute:
            mgContent -- expected to be either a complex definition
                with model group content, a model group, or model group 
                content.  TODO: should only support the first two.
            localTypes -- produce local class definitions later
            tcListElements -- elements, local/global 
        """
        self.logger.debug("_setTypecodeList(%r): %s" %
                          (self.mgContent, self._item.getItemTrace()))
        
        flat = []
        content = self.mgContent
        
        #TODO: too much slop permitted here, impossible
        # to tell what is going on.
        
        if type(content) is not tuple:
            mg = content
            if not mg.isModelGroup():
                raise Wsdl2PythonErr("Expecting ModelGroup: %s" %
                                     mg.getItemTrace())
                
            self.logger.debug("ModelGroup(%r) contents(%r): %s" %
                  (mg, mg.content, mg.getItemTrace()))
            
            #<group ref>
            if mg.isReference():
                raise RuntimeError("Unexpected modelGroup reference: %s" %
                                   mg.getItemTrace())
            
            #<group name>
            if mg.isDefinition():
                mg = mg.content
                
            if mg.isAll():
                flat = mg.content
                content = [] 
            elif mg.isSequence():
                content = mg.content
            elif mg.isChoice():
                content = mg.content
            else:
                raise RuntimeError("Unknown schema item")
                
        idx = 0
        content = list(content)
        self.logger.debug("content: %r" %content)
        while idx < len(content):
            c = orig = content[idx]
            if c.isElement():
                flat.append(c)
                idx += 1
                continue
            
            if c.isReference() and c.isModelGroup():
                c = c.getModelGroupReference()
                
            if c.isDefinition() and c.isModelGroup():
                c = c.content
                
            if c.isSequence() or c.isChoice():
                begIdx = idx
                endIdx = begIdx + len(c.content)
                for i in range(begIdx, endIdx):
                    content.insert(i, c.content[i-begIdx])
                    
                content.remove(orig)
                continue
            
            raise ContainerError, 'unexpected schema item: %s' %c.getItemTrace()

        # TODO: Need to store "parents" in a dict[id] = list(),
        #    because cannot follow references, but not currently
        #    a big concern. 
        
        self.logger.debug("flat: %r" %list(flat))
        for c in flat:
            tc = TcListComponentContainer()
            # TODO: Remove _getOccurs
            min,max,nil = self._getOccurs(c)
            min = max = None
            maxOccurs = 1
            
            parent = c
            defs = []
            # stop recursion via global ModelGroupDefinition 
            while defs.count(parent) <= 1:
                max = parent.getAttribute('maxOccurs')
                if max == 'unbounded':
                    maxOccurs = '"%s"' %max 
                    break
                
                maxOccurs = int(max) * maxOccurs
                parent = parent._parent()
                if not parent.isModelGroup():
                    break
                
                if parent.isReference():
                    parent = parent.getModelGroupReference()
                    
                if parent.isDefinition():
                    parent = parent.content
                    defs.append(parent)
                
            del defs
            parent = c
            while 1:
                minOccurs = int(parent.getAttribute('minOccurs'))
                if minOccurs == 0 or parent.isChoice():
                    minOccurs = 0
                    break
                
                parent = parent._parent()
                if not parent.isModelGroup():
                    minOccurs = int(c.getAttribute('minOccurs'))
                    break
                
                if parent.isReference():
                    parent = parent.getModelGroupReference()
                    
                if parent.isDefinition():
                    parent = parent.content       
            
            tc.setOccurs(minOccurs, maxOccurs, nil)
            processContents = self._getProcessContents(c)
            tc.setProcessContents(processContents)
            if c.isDeclaration() and c.isElement():
                global_type = c.getAttribute('type')
                content = getattr(c, 'content', None)
                if c.isLocal() and c.isQualified() is False:
                    tc.unQualified()

                if c.isWildCard():
                    tc.setStyleAnyElement()
                elif global_type is not None:
                    tc.name = c.getAttribute('name')
                    ns = global_type[0]
                    if ns in SCHEMA.XSD_LIST:
                        tpc = BTI.get_typeclass(global_type[1],global_type[0])
                        tc.klass = tpc
#                    elif (self.ns,self.name) == global_type:
#                        # elif self._isRecursiveElement(c)
#                        # TODO: Remove this, it only works for 1 level.
#                        tc.setStyleRecursion()
                    else:
                        tc.setGlobalType(*global_type)
#                        tc.klass = '%s.%s' % (NAD.getAlias(ns),
#                            type_class_name(global_type[1]))
                    del ns
                elif content is not None and content.isLocal() and content.isComplex():
                    tc.name = c.getAttribute('name')
                    tc.klass = 'self.__class__.%s' % (element_class_name(tc.name))
                    #TODO: Not an element reference, confusing nomenclature
                    tc.setStyleElementReference()
                    self.localTypes.append(c)
                elif content is not None and content.isLocal() and content.isSimple():
                    # Local Simple Type
                    tc.name = c.getAttribute('name')
                    tc.klass = 'self.__class__.%s' % (element_class_name(tc.name))
                    #TODO: Not an element reference, confusing nomenclature
                    tc.setStyleElementReference()
                    self.localTypes.append(c)
                else:
                    raise ContainerError, 'unexpected item: %s' % c.getItemTrace()

            elif c.isReference():
                # element references
                ref = c.getAttribute('ref')
#                tc.klass = '%s.%s' % (NAD.getAlias(ref[0]),
#                                          element_class_name(ref[1]) )
                tc.setStyleElementReference()
                tc.setGlobalType(*ref)
            else:
                raise ContainerError, 'unexpected item: %s' % c.getItemTrace()

            self.tcListElements.append(tc)