xmlclass/xmlclass.py
changeset 1765 ccf59c1f0b45
parent 1764 d5df428640ff
child 1767 c74815729afd
equal deleted inserted replaced
1764:d5df428640ff 1765:ccf59c1f0b45
  1824         element_class = self.GetElementClass(element_tag, parent_tag)
  1824         element_class = self.GetElementClass(element_tag, parent_tag)
  1825         if isinstance(element_class, ListType):
  1825         if isinstance(element_class, ListType):
  1826             if class_idx is not None and class_idx < len(element_class):
  1826             if class_idx is not None and class_idx < len(element_class):
  1827                 new_element = element_class[class_idx]()
  1827                 new_element = element_class[class_idx]()
  1828             else:
  1828             else:
  1829                 raise ValueError, "No corresponding class found!"
  1829                 raise ValueError("No corresponding class found!")
  1830         else:
  1830         else:
  1831             new_element = element_class()
  1831             new_element = element_class()
  1832         DefaultElementClass.__setattr__(new_element, "tag", self.DefaultNamespaceFormat % element_tag)
  1832         DefaultElementClass.__setattr__(new_element, "tag", self.DefaultNamespaceFormat % element_tag)
  1833         new_element._init_()
  1833         new_element._init_()
  1834         return new_element
  1834         return new_element