You are here

protected function FeedsXPathParserDOMXPath::debug in Feeds XPath Parser 6

Same name and namespace in other branches
  1. 7 FeedsXPathParserDOMXPath.inc \FeedsXPathParserDOMXPath::debug()

Renders our debug messages into a list.

Parameters

mixed $data: The result of an XPath query. Either a scalar or a DOMNodeList.

string $source: The source key that produced this query.

1 call to FeedsXPathParserDOMXPath::debug()
FeedsXPathParserDOMXPath::namespacedQuery in ./FeedsXPathParserDOMXPath.inc
Executes an XPath query with namespace support.

File

./FeedsXPathParserDOMXPath.inc, line 51
Provides a custom version of DOMXPath for use with feeds_xpathparser.

Class

FeedsXPathParserDOMXPath
Wraps DOMXPath providing enhanced debugging and special namespace handling.

Code

protected function debug($data, $source) {
  $output = "{$source} : <ul>";
  if ($data instanceof DOMNodeList) {
    foreach ($data as $node) {
      $output .= '<li>' . check_plain($this->doc
        ->saveXML($node)) . '</li>';
    }
  }
  else {
    $output .= '<li>' . check_plain($data) . '</li>';
  }
  $output .= '</ul>';
  drupal_set_message($output);
}