Ejemplo n.º 1
0
Archivo: node.py Proyecto: gem/sidd
 def from_xml(self, xmlnode):
     self.name = get_node_attrib(xmlnode, 'name')
     self.level = get_node_attrib(xmlnode, 'level')
     for mod_node in xmlnode.findall('modifiervalue'):
         if mod_node.attrib['value'] == 'None':
             val = None
         else:
             val = get_node_attrib(mod_node, 'value')            
         self.values[val]=float(get_node_attrib(mod_node, 'weight'))                 
Ejemplo n.º 2
0
Archivo: node.py Proyecto: gem/sidd
 def from_xml(self, xmlnode):
     """ construct node and children from XML """  
     self.name = get_node_attrib(xmlnode, 'attribute')      
     self.value = get_node_attrib(xmlnode, 'value')
     self.level = int(get_node_attrib(xmlnode, 'level'))
     self.weight = float(get_node_attrib(xmlnode, 'weight'))
     self.count = self.weight
     self.is_default = str(get_node_attrib(xmlnode, 'is_default')).upper()=='TRUE'
     self.is_skipped = str(get_node_attrib(xmlnode, 'is_skipped')).upper()=='TRUE'
     
     for add_node in xmlnode.findall('additional'):
         for idx, label in enumerate(self.label_additional):
             add_value = get_node_attrib(add_node, label)
             if add_value != '':
                 self.additional[idx]=add_value
     
     for mod_node in xmlnode.findall('modifiers/modifier'):
         mod = StatisticModifier()
         mod.from_xml(mod_node)
         self.modifiers.append(mod)
         
     for childnode in xmlnode.findall('children/node'):
         logAPICall.log('created new child with xmlnode %s' % childnode, logAPICall.DEBUG_L2)
         node = StatisticNode(self)
         node.from_xml(childnode)
         self.children.append(node)
Ejemplo n.º 3
0
Archivo: ms.py Proyecto: gem/sidd
    def from_xml_tree(self, tree):
        # check to make sure it is correct.
        # use DTD???
        tax = tree.find('taxonomy')
        self.taxonomy = get_taxonomy(tax.find('name').text)
        self.ms = {}
        for zone in tree.findall("zone"):
            stats = Statistics(self.taxonomy)
            stats.from_xml(zone.find('node'))
            stats.finalized = True
            #stats.finalize()
            stats.attributes = stats.get_attributes(stats.get_tree())

            #self.ms[zone.attrib['name']] = stats
            ms_zone = MappingSchemeZone(get_node_attrib(zone, 'name'))
            ms_zone.stats = stats
            self.zones.append(ms_zone)

        self.sort_zones()
Ejemplo n.º 4
0
    def from_xml_tree(self, tree):
        # check to make sure it is correct.
        # use DTD???
        tax = tree.find('taxonomy')
        self.taxonomy = get_taxonomy(tax.find('name').text)        
        self.ms = {}
        for zone in tree.findall("zone"):
            stats = Statistics(self.taxonomy)
            stats.from_xml(zone.find('node'))
            stats.finalized = True
            #stats.finalize()
            stats.attributes = stats.get_attributes(stats.get_tree())

            #self.ms[zone.attrib['name']] = stats
            ms_zone = MappingSchemeZone(get_node_attrib(zone, 'name'))
            ms_zone.stats = stats
            self.zones.append(ms_zone)
                      
        self.sort_zones()