Código:
Y esto es lo que me aparece por consola:int firstPosc=0, frequency, strlLengthPuntoComa, cont=0;
double valueRead;
string strTextLine, weights="<Weights>", tecla;
//Para la lectura de cada linea del fichero
char textLine[250];
//Para la lectura del fichero
char *c, *puntoYComa;
//Ignoramos la 1ª linea
c = fgets(textLine, 250, dataFile);
//La segunda linea debe ser igual a: <Weights>
c = fgets(textLine, 250, dataFile);
strTextLine=string(textLine);
cout << "strTextLine: " << strTextLine << endl;
cout << "weights: " << weights << endl;
cout << "strTextLine.compare(weights): " << strTextLine.compare(weights) << " ,pulsa algo para continuar(g): " << endl; --> ESTA COMPARACION ME DEVUELVE 1
// string t1str="A", t2str="A", t3str="B";
// cout << "t1str: " << t1str << " t2str: " << t2str << " t3str: " << t3str << endl;
// cout << "t1str.compare(t1str): " << t1str.compare(t1str) << endl;
// cout << "t2str.compare(t2str): " << t2str.compare(t2str) << endl;
// cout << "t1str.compare(t2str): " << t1str.compare(t2str) << endl;
// cout << "t3str.compare(t2str): " << t3str.compare(t2str) << " ,pulsa algo para continuar(g): " << endl;
// cin >> tecla; // --> ESTAS COMPARACIONES ME DEVUELVE LOS VALORES CORRECTOS
if(strTextLine.compare(weights)==0){ //SIEMPRE ME DEVUELVE 1 LA COMPARACIÓN
//La tercera contiene los datos y la 4ª que sería el cierre de tag nos da igual
c = fgets(textLine, 250, dataFile);
strTextLine=c;
frequency=count(strTextLine.begin(), strTextLine.end(), ';');
if(frequency==arrayDoubleSize){
//Pedimos memoria
(*arrayDoubles_)=new double[arrayDoubleSize];
puntoYComa=strchr(textLine,';');
while(puntoYComa!=NULL){
strlLengthPuntoComa=puntoYComa-textLine+1;
valueRead=XMLReaderObtainFloatValue(firstPosc, strlLengthPuntoComa, textLine);
(*arrayDoubles_)[cont]=valueRead;
cout << valueRead << " :: " << endl;
cont++;
firstPosc=puntoYComa-textLine+1;
puntoYComa=strchr(puntoYComa+1,';');
}
//error = 0 --> OK
}
else{
(*error_)=-2;
// Debe haber el mismo número de ; que de valores a leer
}
}
else{
(*error_)=-1;
//El fichero está mal formado, falta la apertura de tag (no compruebo el cierre)
}
}
Código:
Path del fichero XML con la configuracion: C:\temp\pesos.xml strTextLine: <Weights> weights: <Weights> strTextLine.compare(weights): 1 ,pulsa algo para continuar(g):


