Merge file2doc and str2doc.