You are here

protected function FeedsXPathParserBase::errorStop in Feeds XPath Parser 6

Same name and namespace in other branches
  1. 7 FeedsXPathParserBase.inc \FeedsXPathParserBase::errorStop()
2 calls to FeedsXPathParserBase::errorStop()
FeedsXPathParserHTML::setup in ./FeedsXPathParserHTML.inc
Implementation of FeedsXPathParserBase::setup().
FeedsXPathParserXML::setup in ./FeedsXPathParserXML.inc
Implementation of FeedsXPathParserBase::setup().

File

./FeedsXPathParserBase.inc, line 446
Provides the abstract base class for FeedsXPathParserHTML and FeedsXPathParserXML.

Class

FeedsXPathParserBase
Base class for the HTML and XML parsers.

Code

protected function errorStop($use, $print = TRUE) {
  if ($print) {
    foreach (libxml_get_errors() as $error) {
      switch ($error->level) {
        case LIBXML_ERR_WARNING:
        case LIBXML_ERR_ERROR:
          $type = 'warning';
          break;
        case LIBXML_ERR_FATAL:
          $type = 'error';
          break;
      }
      $message = t('%error on line %num. Error code: %code', array(
        '%error' => trim($error->message),
        '%num' => $error->line,
        '%code' => $error->code,
      ));
      drupal_set_message($message, $type, FALSE);
    }
  }
  libxml_clear_errors();
  libxml_use_internal_errors($use);
}