I have a text file which I am adding tags to in order to make it XML readable. In order for our reader to recognize it as valid, each line must at least be wrapped in tags. My issue arises because this is actually a Syriac translation dictionary and so there are many non-standard characters (the actual Syriac words). The most straight-forward way I see to accomplish what I need is to simply prepend and append each line with the needed tags, in place, without necessarily accessing or modifying the rest of the line. Any other options would also be greatly appreciated.
ifstream in_file;
string file_name;
string line;
string line2;
string pre_text;
string post_text;
int num = 1;
pre_text = "<entry n=\"";
post_text = "</entry>";
file_name = "D:/TEI/dictionary1.txt";
in_file.open(file_name.c_str());
if (in_file.is_open()){
while (getline(in_file, line)){
line2 = pre_text + to_string(num) + "\">" + line + post_text;
cout << line2;
num++;
}
}
The file in question may be downloaded here.
Aucun commentaire:
Enregistrer un commentaire