I'll assume you know how to insert it into the database yourself :p
I usually use ereg_replace for this. Using file() to read each line in the file into an array, strip the new lines, then use ereg_replace to get two variables. One for the file, one for the caption.
$file = file("txt.txt");
foreach($file as $item) {
$item = str_replace("\r","",$item); /* Damn Windows */
$item = str_replace("\n","",$item); /* trim newlines */
/* Get file */
$f = ereg_replace(".*<file>","",$item);
$f = ereg_replace("</file>.*","",$f);
/* Get caption */
$c = ereg_replace(".*<cap>","",$item);
$c = ereg_replace("</cap>.*","",$c);
}