I'm aware there are several XML libaries out there, but unfortunately, I am unable to use them for a school project I am working on.
I have a program that created this XML file.
<theKey>
<theValue>23432</theValue>
</theKey>
What I am trying to do is parse out "23432" between the tags. However, there are random tags in the file so may not always on the second line from the top. Also, I don't know how many digits the number is between the tags.
Here is the code I developed so far. It is basic because I don't know what I can use that is part of the C++ language that will parse the value out. My hint, from me working with JAVA, is to use somethign from the "String" library but so far I am coming up short on what I can use.
Can anyone give me direction or a clue on what I can do/use? Thanks a lot.
Here is the code I developed so far:
#include <iostream>
#include <fstream>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using std::fstream;
using std::string;
using std::ifstream;
int main()
{
ifstream inFile;
inFile.open("theXML.xml");
if (!inFile)
{
}
string x;
while (inFile >> x)
{
cout << x << endl;
}
inFile.close();
system ( "PAUSE" );
return 0;
}