I have to parse a TXT file of XML messages and save the ID value in another file. I can reach up to the <ID>
tag using find function. But how to get the value, also the length of value varies.
<note>
<to>Tove</to>
<from>Jani</from>
<ID>Fx12345</ID>
<body>Don't forget me this weekend!</body>
</note>
<note>
<to>Tove</to>
<from>Alex</from>
<ID>Fx1236785</ID>
<body>Don't forget me this weekend!</body>
</note>
I'm using this approach
while (!fileInput.eof()) {
getline(fileInput, line);
if ((offset = line.find("<ID>", 0)) != string::npos) {
// How to get only value
}
}