How to convert formatted text to XML in C++ -
i have read text file in, , need convert received input xml data.
e.g.: reading text file yields:
english 100 science 80 computers 77
now need output as:
<head> <english>100</english> <science>80</science> <computers>77</computers> </head>
how can achieve this?
what can is, after reading text file append <
, >
subject.
if fout
output std::filestream
, subject
std::string
, , score
int
or unsigned
:
fout << "<head>" << std::endl; while (/* file not finished */) { // read string , int file subject.insert(0,"<"); subject.insert(subject.size(),">"); fout << subject << score; subject.insert(1,"/"); fout << subject<< std::endl; } fout << "</head>" << std::endl;
Comments
Post a Comment