def endElement(self, tag): if tag == "title": print("\n%s: %s" % ( lang('_note_processing'), self.note.get_title())) elif tag == "content": pass elif tag == "resource": print("---%s: %s" % (lang('_exporting_attachment'), self.attachment.get_filename())) self.attachment.finalize(keep_file_names) self.in_resource_attributes = False elif tag == "data": self.note.add_attachment(self.attachment) elif tag == "note": # Last tag called before starting a new note #TODO ask user if they want to use qownnotes style. i.e. make attachment links "file://media/aldskfj.png" print("---%s: %s" % (lang('_exporting_note'), self.note.get_filename())) self.note.finalize() elif tag == "note-attributes": self.in_note_attributes = False elif tag == "en-export": #Last tag closed in the whole .enex file print("\n####%s####\n" % (lang('_export_finished')))
def startElement(self, tag, attributes): ''' Called when a new element is found ''' self.CurrentData = tag if tag == "en-export": # First tag found in .enex file print("\n####%s####" % (lang("_export_started"))) elif tag == "note": # New note found self.note = Note() self.note.set_path(current_file) elif tag == "data": # Found an attachment self.attachment = Attachment() self.attachment.set_path(current_file) self.attachment.set_created_date(self.note.get_created_date()) self.attachment.set_filename(self.note.get_title()) self.attachment.set_uuid(self.note.get_uuid()) elif tag == "note-attributes": self.in_note_attributes = True elif tag == "resource-attributes": self.in_resource_attributes = True