Package pyxsd :: Package elementRepresentatives :: Module complexType
[hide private]
[frames] | no frames]

Source Code for Module pyxsd.elementRepresentatives.complexType

 1   
 2  from xsdType import XsdType 
 3  #============================================================ 
 4  # 
 5   
6 -class ComplexType(XsdType):
7 """ 8 The class for the complexType tag. Subclass of *XsdType*. 9 """ 10 #============================================================ 11 #
12 - def __init__(self, xsdElement, parent):
13 """ 14 Keeps a list of sequences and choices that are children of it. 15 Stores itself in the schema dictionary of complexTypes. 16 Uses the XsdType `__init__`. 17 See *ElementRepresentative* for more documentation. 18 """ 19 self.sequencesOrChoices = [] 20 21 XsdType.__init__(self, xsdElement, parent) 22 23 self.getSchema().complexTypes[self.name] = self
24 25 #============================================================ 26 #
27 - def getElements(self):
28 """ 29 Returns a list of elements. Uses lazy evaluation. Goes through the `sequencesOrChoices` list, 30 goes through each ones elements, adds its container information, then adds the element to a list 31 which it returns. 32 33 No parameters. 34 """ 35 elements = getattr(self, 'elements_', None) 36 37 if not elements == None: 38 return elements 39 40 self.elements_ = [] 41 itemInfo = None 42 for item in self.sequencesOrChoices: 43 if item.tagType == "sequence": 44 itemInfo = "sequence" 45 if item.tagType == "choice": 46 itemInfo = "choice" 47 for element in item.elements: 48 element.sOrC = itemInfo 49 self.elements_.append(element) 50 return self.elements_
51 52 #============================================================ 53 #
54 - def gatherFacets(self):
55 """ 56 returns a blank dictionary. Needed for SimpleType, so the function can be called for any type without error. 57 """ 58 return {}
59