示例#1
0
static void _errorSAXFunc(void *xmlp,
			  const char *msg,
			  ...)
{
  va_list args;
  va_start (args, msg);
  UT_String errorMessage;
  UT_String_vprintf (errorMessage,msg, args);
  va_end (args);
  // Handle 'nbsp' here
  UT_XML * pXML = reinterpret_cast<UT_XML *>(xmlp);
  pXML->incMinorErrors();
  char * szErr = g_strdup(errorMessage.c_str() );
  if(strstr(szErr,"'nbsp' not defined") != NULL)
  {
    UT_DEBUGMSG(("nbsp found in stream errs %d \n",pXML->getNumMinorErrors()));
      pXML->incRecoveredErrors();
      const char buffer []= { (char)0xa0};
      pXML->charData(buffer,1); 
  }
  else if(strstr(szErr,"not defined") != NULL)
  {
      pXML->incRecoveredErrors();
  }
  else
  {
      UT_DEBUGMSG(("SAX function error here \n"));
      UT_DEBUGMSG(("%s", errorMessage.c_str()));
// This is a runtime error, an ASSERT is out of place.
//      UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
  }
  FREEP(szErr);
}
示例#2
0
static void _cdata (void * userData, const gchar * buffer, int length)
{
  UT_XML * pXML = reinterpret_cast<UT_XML *>(userData);
  pXML->cdataSection (true);
  pXML->charData (reinterpret_cast<const char *>(buffer), length);
  pXML->cdataSection (false);
}