def parse(input, handler):
for line in input:
...
if line.startswith("AC "):
words = line.replace(";", " ").split()
for word in words:
handler.element("accession", word)
...
return handler.get_record()
Even this isn't quite good enough.
modifies data
don't know position information
still have to write all that recognition code by hand