def _getTables(self, xml): tables = [] for table in xml.getElementsByTagName("table"): tmp = Table() for attributeName, attributeValue in table.attributes.items(): if attributeName.lower() == "name": tmp.name = attributeValue elif attributeName.lower() == "description": tmp.description = attributeValue elif attributeName.lower() == "props": for prop in attributeValue.split(", "): if prop == "add": tmp.add = True elif prop == "edit": tmp.edit = True elif prop == "delete": tmp.delete = True else: raise ValueError( "Invalid format of props string: {}".format( attributeValue)) elif attributeName.lower() == "ht_table_flags": tmp.ht_table_flags = attributeValue elif attributeName.lower() == "access_level": tmp.access_level = attributeValue else: raise ValueError( "Incorrect attribute name \"{}\" in tag \"{}\" ". format(attributeName, table.nodeName)) tmp.fields = self._getFields(table) tmp.constraints = self._getConstraints(table) tmp.indices = self._getIndices(table) tables.append(tmp) return tables