No misunderstandings please... This is what I was working on:
The only bug to fix has to do with DTD (minor one but it crashes it...)
Working together means that I must do marathon running?
Geez..., do not mix premature constructive criticism with the need to
not be
releasing buggy stuff..
The code below works if you take out DTD elements out of any xml file
that is VALID.
Handles the <,> and >,< pairs correctly no matter how weird the syntax
is...
IT IS BUGGY BUT IT IS UNINFORMED, and most of all *SMALL*
Thank you for making my trouble worth nothing, you could not wait a
couple of days more, could you...
----------------------------------------CUT---------------------------------------------
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
using namespace std;
int main ()
{
string linebuffer;
int lnct = 0;
vector<string> myvector;
vector<string> processing;
string testing;
string grabITEM;
myvector.clear();
ifstream myfile("coreutils.xml"); // take out DTD stuff please...
if ( myfile.is_open() )
{
while (getline(myfile,linebuffer,'\n'))
{
myvector.push_back(linebuffer);
}
myfile.close();
linebuffer.clear();
}
else
{
cout << "file not found!" << endl;
}
for (lnct = 0; lnct < myvector.size(); lnct++)
{
testing = myvector.at(lnct);
while ( !testing.empty() )
{
if (!linebuffer.empty()) { testing = linebuffer + "
" + testing; }
linebuffer.clear();
int stopTAG = testing.find_first_of(">");
int openTAG = testing.find_first_of("<");
if ( ( openTAG == string::npos ) || ( stopTAG
== string::npos ) )
{
if (( openTAG == string::npos ) && (
stopTAG == string::npos ))
{
cout << testing << endl;
testing.clear();
break;
}
else if (( openTAG != string::npos ) &&
( stopTAG == string::npos ))
{
linebuffer =
testing.substr(openTAG);
cout << testing.substr(0, openTAG)
<< endl;
testing.clear();
break;
}
}
cout << testing.substr(0, openTAG) << endl;
grabITEM = testing.substr(openTAG, stopTAG + 1
- openTAG);
cout << grabITEM << endl;
testing = testing.substr(stopTAG + 1);
}
}
myvector.clear();
return 0;
}
------------------------------------- CUT
---------------------------------------------------
--
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page