def visit_choice(self, node, parent): """ <choice id = ID maxOccurs= (nonNegativeInteger | unbounded) : 1 minOccurs= nonNegativeInteger : 1 {any attributes with non-schema Namespace}...> Content: (annotation?, (element | group | choice | sequence | any)*) </choice> """ # There should be only max nodes, first node (annotation) is irrelevant children = node.getchildren() if children[0].tag == tags.annotation: children.pop(0) choices = [] for child in children: elm = self.process(child, node) elm.min_occurs = 0 choices.append(elm) return xsd_elements.Choice(choices)
def visit_choice(self, node, parent): """ <choice id = ID maxOccurs= (nonNegativeInteger | unbounded) : 1 minOccurs= nonNegativeInteger : 1 {any attributes with non-schema Namespace}...> Content: (annotation?, (element | group | choice | sequence | any)*) </choice> """ min_occurs, max_occurs = _process_occurs_attrs(node) children = node.getchildren() annotation, children = self._pop_annotation(children) choices = [] for child in children: elm = self.process(child, node) choices.append(elm) return xsd_elements.Choice( choices, min_occurs=min_occurs, max_occurs=max_occurs)