6 """
7 The class for the choice tag. Subclass of *ElementRepresentative*.
8 """
9
11 """
12 Adds itself to the sequencesOrChoices list in its containing complexType.
13 Makes a blank list for element children.
14 Uses the ER '__init__`.
15 See *ElementRepresentative* for more documentation.
16 """
17 self.elements = []
18
19 ElementRepresentative.__init__(self, xsdElement, parent)
20
21 self.getContainingType().sequencesOrChoices.append(self)
22
23
24
26 """
27 Makes a name like this- choice`some id number`.
28 """
29 choiceNum = len(self.getContainingType().sequencesOrChoices) + 1
30
31 contName = self.getContainingTypeName()
32
33 name = "choice%i" % (choiceNum)
34
35 return name
36
37
38
40 """
41 retrieves the minOccurs value for elements in the choice.
42 Sets it to the default of 1 if it is not specified.
43
44 No parameters.
45 """
46
47 return int(getattr(self, 'minOccurs', 1))
48
49
50
52 """
53 retrieves the maxOccurs value for elements in the choice.
54 Sets it to the default of 1 if it is not specified.
55 Sets 'unbounded' values to 99999, since it needs to be an
56 integer.
57
58 No parameters.
59 """
60 maxOccurs = getattr(self, 'maxOccurs', 1)
61 if maxOccurs == 'unbounded':
62 return 99999
63 return int(maxOccurs)