You are here

protected function QueryPathXmlParser::validateExpression in Feeds extensible parsers 8

Validates an expression.

Parameters

string &$expression: The expression to validate.

Return value

string|null Return the error string, or null if validation was passed.

Overrides XmlParser::validateExpression

File

src/Feeds/Parser/QueryPathXmlParser.php, line 115

Class

QueryPathXmlParser
Defines a XML parser using QueryPath.

Namespace

Drupal\feeds_ex\Feeds\Parser

Code

protected function validateExpression(&$expression) {
  $this
    ->loadLibrary();
  $expression = trim($expression);
  if (!$expression) {
    return;
  }
  try {
    $parser = QueryPath::with(NULL, $expression);
  } catch (ParseException $e) {
    return new HtmlEscapedText($e
      ->getMessage());
  }
}