def to_minimal_xml(self): element = xml_util.create('pattern') xml_util.set_attr(element, 'id', self.id) xml_util.set_attr(element, 'title', self.title) xml_util.set_variables(element, self.variables) for rule in self.rules: element.append(rule.to_minimal_xml()) return element
def to_minimal_xml(self): element = xml_util.create('rule') xml_util.set_attr(element, 'id', self.id) xml_util.set_attr(element, 'context', self.context) xml_util.set_variables(element, self.variables) for assertion in self.assertions: element.append(assertion.to_minimal_xml()) for report in self.reports: element.append(report.to_minimal_xml()) return element
def to_minimal_xml(self): element = xml_util.create('phase') xml_util.set_attr(element, 'id', self.id) xml_util.set_variables(element, self.variables) for pattern in self.active_patterns: active_element = xml_util.create('active') xml_util.set_attr(active_element, 'pattern', pattern) element.append(active_element) return element
def to_xml(self): element = E('svrl', self.NAME) xml_util.set_attr(element, 'id', self.id) xml_util.set_attr(element, 'location', self.location) xml_util.set_attr(element, 'test', self.test) xml_util.set_attr(element, 'role', self.role) xml_util.set_attr(element, 'flag', self.flag) for diagnostic_reference in self.diagnostic_references: element.append(diagnostic_reference.to_xml()) if self.text is not None: element.append(self.text.to_xml()) return element
def to_xml(self): element = E('svrl', 'fired-rule') xml_util.set_attr(element, 'id', self.id) xml_util.set_attr(element, 'context', self.context) xml_util.set_attr(element, 'role', self.role) xml_util.set_attr(element, 'flag', self.flag) return element
def to_minimal_xml(self, minimal=False): """ Creates a minimal syntax schema according to section 6.2 of the specification. TODO: non-minimal output :return: An ElementTree with the current Schema specification in minimal form """ if not self.abstract_patterns_processed: self.process_abstract_patterns() root = xml_util.create('schema', add_nsmap=True) xml_util.set_attr(root, 'id', self.id) xml_util.set_attr(root, 'defaultPhase', self.default_phase) xml_util.set_attr(root, 'schemaVersion', self.schema_version) xml_util.set_attr(root, 'queryBinding', self.query_binding_name) xml_util.set_variables(root, self.variables) for phase in self.phases.values(): root.append(phase.to_minimal_xml()) for pattern in self.patterns.values(): root.append(pattern.to_minimal_xml()) return root
def to_xml(self): element = E('svrl', 'schematron-output', nsmap=self.nsmap) xml_util.set_attr(element, 'title', self.title) xml_util.set_attr(element, 'phase', self.phase) xml_util.set_attr(element, 'schemaVersion', self.schema_version) for text in self.texts: element.append(text.to_xml()) for prefix, uri in self.attribute_prefixes.items(): element.append(E('svrl', 'ns-prefix-in-attribute-values', {'prefix': prefix, 'uri': uri})) for active_pattern in self.active_patterns: # Note: fired-rules, failed-assert and successful-report elements are *not* nested! # So add this element immediately element.append(active_pattern.to_xml()) for fired_rule in active_pattern.fired_rules: element.append(fired_rule.to_xml()) for report in fired_rule.reports: element.append(report.to_xml()) return element
def to_minimal_xml(self): # TODO: which elements to add? element = super().to_minimal_xml() xml_util.set_attr(element, 'test', self.test) xml_util.set_attr(element, 'flag', self.flag) return element
def to_xml(self): element = E('svrl', 'diagnostic-reference') xml_util.set_attr(element, 'diagnostic', self.diagnostic) if self.text is not None: element.append(self.text.to_xml())
def to_xml(self): element = E('svrl', 'active_pattern') xml_util.set_attr(element, 'id', self.id) xml_util.set_attr(element, 'name', self.name) xml_util.set_attr(element, 'role', self.role) return element