def _setUpElements(self):
self.logger.debug("<STR_LIT>" %self._item.getItemTrace())<EOL>if hasattr(self, '<STR_LIT>'):<EOL><INDENT>return<EOL><DEDENT>self._done = True<EOL>flat = []<EOL>content = self.mgContent<EOL>if type(self.mgContent) is not tuple:<EOL><INDENT>mg = self.mgContent<EOL>if not mg.isModelGroup(): <EOL><INDENT>mg = mg.content<EOL><DEDENT>content = mg.content<EOL>if mg.isAll():<EOL><INDENT>flat = content<EOL>content = [] <EOL><DEDENT>elif mg.isModelGroup() and mg.isDefinition():<EOL><INDENT>mg = mg.content<EOL>content = mg.content            <EOL><DEDENT><DEDENT>idx = <NUM_LIT:0><EOL>content = list(content)<EOL>while idx < len(content):<EOL><INDENT>c = orig = content[idx]<EOL>if c.isElement():<EOL><INDENT>flat.append(c)<EOL>idx += <NUM_LIT:1><EOL>continue<EOL><DEDENT>if c.isReference() and c.isModelGroup():<EOL><INDENT>c = c.getModelGroupReference()<EOL><DEDENT>if c.isDefinition() and c.isModelGroup():<EOL><INDENT>c = c.content<EOL><DEDENT>if c.isSequence() or c.isChoice():<EOL><INDENT>begIdx = idx<EOL>endIdx = begIdx + len(c.content)<EOL>for i in range(begIdx, endIdx):<EOL><INDENT>content.insert(i, c.content[i-begIdx])<EOL><DEDENT>content.remove(orig)<EOL>continue<EOL><DEDENT>raise ContainerError('<STR_LIT>' %c.getItemTrace())<EOL><DEDENT>for c in flat:<EOL><INDENT>if c.isDeclaration() and c.isElement():<EOL><INDENT>defaultValue = "<STR_LIT:None>"<EOL>parent = c<EOL>defs = []<EOL>while defs.count(parent) <= <NUM_LIT:1>:<EOL><INDENT>maxOccurs = parent.getAttribute('<STR_LIT>')<EOL>if maxOccurs == '<STR_LIT>' or int(maxOccurs) > <NUM_LIT:1>:<EOL><INDENT>defaultValue = "<STR_LIT>"<EOL>break<EOL><DEDENT>parent = parent._parent()<EOL>if not parent.isModelGroup():<EOL><INDENT>break<EOL><DEDENT>if parent.isReference():<EOL><INDENT>parent = parent.getModelGroupReference()<EOL><DEDENT>if parent.isDefinition():<EOL><INDENT>parent = parent.content<EOL>defs.append(parent)                <EOL><DEDENT><DEDENT>if None ==  c.getAttribute('<STR_LIT:name>') and c.isWildCard():<EOL><INDENT>e = '<STR_LIT>' %(ID3, <EOL>self.getAttributeName('<STR_LIT>'), defaultValue)<EOL><DEDENT>else:<EOL><INDENT>e = '<STR_LIT>' %(ID3, <EOL>self.getAttributeName(c.getAttribute('<STR_LIT:name>')), defaultValue)<EOL><DEDENT>self.elementAttrs.append(e)<EOL>continue<EOL><DEDENT>if c.isReference():<EOL><INDENT>e = '<STR_LIT>' %(ID3,<EOL>self.mangle(c.getAttribute('<STR_LIT>')[<NUM_LIT:1>]))<EOL>self.elementAttrs.append(e)<EOL>continue<EOL><DEDENT>raise ContainerError('<STR_LIT>' % c.getItemTrace())<EOL><DEDENT>return<EOL>
TODO: Remove this method

        This method ONLY sets up the instance attributes.
        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.