Hi, I write the part of SAX code:
void MyProject::startElement(const XMLCh* const name , AttributeList& attributes) { int r; int pippo=atoi(XTOC(attributes.getValue("Value")));
cout << pippo;
Daniele,
startElement is called every time an XML element is found in the file; you are not checking what the "name" is, and expect that a "Value" attribute is there. So, unless all of the elements in the file have a "Value" attribute, you will get a NULL pointer and try to run XTOC on it, and you will get the segmentation fault.
A more robust code would be
{
if(XMLString::equals(name,g_theElementIamLookingFor))
{
const XMLCh* value=attributes.getValue("Value");
if(value)
cout << atoi(XTOC(value));
}
}Alberto
The output code is: <?xml version="1.0" encoding="LATIN1"?> Segmentation fault
What can I do to solve it?
Thanks Daniele
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
