724 if infos is not None: |
724 if infos is not None: |
725 sequence_number = 0 |
725 sequence_number = 0 |
726 element_idx = 0 |
726 element_idx = 0 |
727 while element_idx < len(value["value"]): |
727 while element_idx < len(value["value"]): |
728 for element_infos in infos["elements"]: |
728 for element_infos in infos["elements"]: |
729 if element_infos["name"] == value["value"][element_idx]["name"]: |
729 element_value = None |
730 element_value = value["value"][element_idx]["value"] |
730 if element_infos["type"] == CHOICE: |
731 element_idx += 1 |
731 choice_infos = None |
|
732 if element_idx < len(value["value"]): |
|
733 for choice in element_infos["choices"]: |
|
734 if choice["name"] == value["value"][element_idx]["name"]: |
|
735 choice_infos = choice |
|
736 element_value = value["value"][element_idx]["value"] |
|
737 element_idx += 1 |
|
738 break |
|
739 if ((choice_infos is not None and |
|
740 not CheckElementValue(factory, choice_infos["name"], choice_infos, element_value, False)) or |
|
741 (choice_infos is None and element_infos["minOccurs"] > 0)): |
|
742 raise ValueError("Invalid sequence value in attribute 'content'") |
732 else: |
743 else: |
733 element_value = None |
744 if element_idx < len(value["value"]) and element_infos["name"] == value["value"][element_idx]["name"]: |
734 if not CheckElementValue(factory, element_infos["name"], element_infos, element_value, False): |
745 element_value = value["value"][element_idx]["value"] |
735 raise ValueError("Invalid sequence value in attribute 'content'") |
746 element_idx += 1 |
|
747 if not CheckElementValue(factory, element_infos["name"], element_infos, element_value, False): |
|
748 raise ValueError("Invalid sequence value in attribute 'content'") |
736 sequence_number += 1 |
749 sequence_number += 1 |
737 if sequence_number < infos["minOccurs"] or infos["maxOccurs"] != "unbounded" and sequence_number > infos["maxOccurs"]: |
750 if sequence_number < infos["minOccurs"] or infos["maxOccurs"] != "unbounded" and sequence_number > infos["maxOccurs"]: |
738 raise ValueError("Invalid sequence value in attribute 'content'") |
751 raise ValueError("Invalid sequence value in attribute 'content'") |
739 return True |
752 return True |
740 else: |
753 else: |