You are here

class QueryPathParseException in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/QueryPath.php \QueryPathParseException
  2. 7.2 QueryPath/QueryPath.php \QueryPathParseException

Hierarchy

Expanded class hierarchy of QueryPathParseException

4 string references to 'QueryPathParseException'
QueryPath::parseXMLFile in QueryPath/QueryPath.php
QueryPath::parseXMLString in QueryPath/QueryPath.php
QueryPath::prepareInsert in QueryPath/QueryPath.php
Prepare an item for insertion into a DOM.
QueryPath::writeHTML in QueryPath/QueryPath.php

File

QueryPath/QueryPath.php, line 2217

View source
class QueryPathParseException extends QueryPathException {
  const ERR_MSG_FORMAT = 'Parse error in %s on line %d column %d: %s (%d)';
  const WARN_MSG_FORMAT = 'Parser warning in %s on line %d column %d: %s (%d)';
  public function __construct($msg = '', $code = 0, $file = NULL, $line = NULL) {
    $msgs = array();
    foreach (libxml_get_errors() as $err) {
      $format = $err->level == LIBXML_ERR_WARNING ? self::WARN_MSG_FORMAT : self::ERR_MSG_FORMAT;
      $msgs[] = sprintf($format, $err->file, $err->line, $err->column, $err->message, $err->code);
    }
    $msg .= implode("\n", $msgs);
    if (isset($file)) {
      $msg .= ' (' . $file;
      if (isset($line)) {
        $msg .= ': ' . $line;
      }
      $msg .= ')';
    }
    parent::__construct($msg, $code);
  }
  public static function initializeFromError($code, $str, $file, $line, $cxt) {
    $class = __CLASS__;
    throw new $class($str, $code, $file, $line);
  }

}

Members