def write_xml_document(self, document): """Writes a string representation of an ``ElementTree`` object to the output stream. :param document: An ``ElementTree`` object. """ self._out.write(ET.tostring(document)) self._out.flush()
def write_event(self, event): """Writes an ``Event`` object to Splunk. :param event: An ``Event`` object. """ if not self.header_written: self._out.write("<stream>") self.header_written = True xml_element = event.get_element() write_str = ET.tostring(xml_element, encoding='UTF-8') write_str = write_str[write_str.find('\n') + 1:] self._out.write(write_str) self._out.flush()