Exemplo n.º 1
0
 def _read_from_xml(self, xml_element, trace_dict):
     ''' Read in the evaluatable form the input XML
     '''
     self.trace_id = trace_dict[xml_element]
     # attributes
     for att_key in xml_element.attrib:
         att_value = xml_element.attrib[att_key]
         if read_from_xml_rule_value(self, att_key, att_value, GACT_VALUES[self.ev_type]):
             continue
         elif self._read_from_xml_other_attributes(att_key, xml_element) == True:
             continue
         else:
             self.ruleset.parse_error(self.trace_id[0], '\'{0}\' element encountered an unexpected attribute \'{1}\''.format(self.ev_type, att_key))
     # elements
     # Get description ... if specified
     for rule_element in xml_element:
         element_name = rule_element.tag.split('}')[-1]
         element_value = rule_element.text
         if element_name == 'description':
             self.description = element_value
         else:
             if self._read_from_xml_other_subelements(rule_element, trace_dict) == True:
                 continue
             else:
                 self.ruleset.parse_error(self.trace_id[0], '\'{0}\' element encountered an unexpected subelement: {1}'.format(self.ev_type, element_name))
     return
Exemplo n.º 2
0
 
 def _read_from_xml(self, xml_element, trace_dict):
     ''' Read in the hanlder alert from the input XML
     '''
     self.trace_id = trace_dict[xml_element]
     # attributes
     for att_key in xml_element.attrib:
         att_value = xml_element.attrib[att_key]
         if read_from_xml_rule_value(self, att_key, att_value, GEHD_HANDLER_ALERT):
             continue
         else:
             self.ruleset.parse_error(self.trace_id[0], '\'on_error\' element encountered an unexpected attribute \'{1}\''.format(att_key))
     # elements
     # Get description ... if specified
     for rule_element in xml_element:
         element_name = rule_element.tag.split('}')[-1]
         element_value = rule_element.text
         if element_name == 'description':
             self.description = element_value
         else:
             self.ruleset.parse_error(self.trace_id[0], '\'on_error\' element encountered an unexpected subelement: {0}'.format(element_name))