I'm trying to read an Xml file recursively using Tinyxml, but when I try to acces the data I get a "Segmentation Fault". here is the code :
int id=0, categoria=0;
const char* nombre;
do{
ingrediente = ingrediente->NextSiblingElement("Ingrediente");
contador++;
if(ingrediente->Attribute("id")!=NULL)
id = atoi( ingrediente->Attribute("id") );
if(ingrediente->Attribute("categoria")!=NULL)
categoria = atoi ( ingrediente->Attribute("categoria") );
if(ingrediente!=NULL)
nombre = ( ( ingrediente->FirstChild() )->ToText() )->Value();
}while(ingrediente);
For some reason, the three "if" lines throws me the Segmentation Fault but I've not idea about where is the problem.
Thanks in advance.