'Write all the findings to the XML file
:return: None, we write the data to the XML'

def _write_findings_to_xml(self):

    req_history = HistoryItem()
    for i in kb.kb.get_all_findings():
        message_node = self._xml.createElement('vulnerability')
        message_node.setAttribute('severity', xml_str(i.get_severity()))
        message_node.setAttribute('method', xml_str(i.get_method()))
        message_node.setAttribute('url', xml_str(i.get_url()))
        message_node.setAttribute('var', xml_str(i.get_token_name()))
        message_node.setAttribute('name', xml_str(i.get_name()))
        message_node.setAttribute('plugin', xml_str(i.get_plugin_name()))
        desc_str = xml_str(i.get_desc(with_id=False))
        description_node = self._xml.createElement('description')
        description = self._xml.createTextNode(desc_str)
        description_node.appendChild(description)
        message_node.appendChild(description_node)
        if i.has_db_details():
            desc_str = xml_str(i.get_long_description())
            description_node = self._xml.createElement('long-description')
            description = self._xml.createTextNode(desc_str)
            description_node.appendChild(description)
            message_node.appendChild(description_node)
            fix_str = xml_str(i.get_fix_guidance())
            fix_node = self._xml.createElement('fix-guidance')
            fix = self._xml.createTextNode(fix_str)
            fix_node.appendChild(fix)
            message_node.appendChild(fix_node)
            fix_effort_str = xml_str(i.get_fix_effort())
            fix_node = self._xml.createElement('fix-effort')
            fix = self._xml.createTextNode(fix_effort_str)
            fix_node.appendChild(fix)
            message_node.appendChild(fix_node)
            if i.get_references():
                references_node = self._xml.createElement('references')
                for ref in i.get_references():
                    ref_node = self._xml.createElement('reference')
                    ref_node.setAttribute('title', xml_str(ref.title))
                    ref_node.setAttribute('url', xml_str(ref.url))
                    references_node.appendChild(ref_node)
                message_node.appendChild(references_node)
        if i.get_id():
            message_node.setAttribute('id', str(i.get_id()))
            transaction_set = self._xml.createElement('http-transactions')
            message_node.appendChild(transaction_set)
            for request_id in i.get_id():
                try:
                    details = req_history.read(request_id)
                except DBException:
                    msg = 'Failed    to    retrieve    request    with    id    %s    from    DB.'
                    print (msg % request_id)
                    continue
                action_set = self._xml.createElement('http-transaction')
                action_set.setAttribute('id', str(request_id))
                transaction_set.appendChild(action_set)
                request_node = self._xml.createElement('http-request')
                self.report_http_action(request_node, details.request)
                action_set.appendChild(request_node)
                response_node = self._xml.createElement('http-response')
                self.report_http_action(response_node, details.response)
                action_set.appendChild(response_node)
        self._top_elem.appendChild(message_node)
