Exemple #1
0
 def from_xml(self, xmlnode):
     """ construct statistic tree from given XML document """
     # perform checking on the node
     if not isinstance(xmlnode, ElementTree._ElementInterface):
         raise StatisticError('input must be of type xml.etree.ElementTree.Element'); 
     
     # clean existing stats
     del self.root
     
     # create new stats tree
     self.root = StatisticNode(None, 'root')
     self.root.from_xml(xmlnode)
Exemple #2
0
 def __init__(self, taxonomy):
     """
     initialize empty statistic using given format file
     format file indicates the order of characteristics in the tree
     """
     self.root = StatisticNode(None, 'root', 'root')
     self.attributes = []
     self.leaves = []
     self.leaves_ordered = False
     self.taxonomy = taxonomy
     self.skips.append(False)
     self.finalized = False
     self.default_parse_order =  [x.name for x in self.taxonomy.attributes]
     
     for attr in self.taxonomy.attributes:
         self.defaults.append(attr.default)
         self.skips.append(False)