You are here

class FeedsExQueryPathHtml in Feeds extensible parsers 7

Same name and namespace in other branches
  1. 7.2 src/FeedsExQueryPathHtml.inc \FeedsExQueryPathHtml

Parses HTML documents with QueryPath.

Hierarchy

Expanded class hierarchy of FeedsExQueryPathHtml

2 string references to 'FeedsExQueryPathHtml'
FeedsExQueryPathHtml.test in src/Tests/FeedsExQueryPathHtml.test
feeds_ex_feeds_plugins in ./feeds_ex.feeds.inc
Implements hook_feeds_plugins().

File

src/FeedsExQueryPathHtml.inc, line 11
Contains FeedsExQueryPathHtml.

View source
class FeedsExQueryPathHtml extends FeedsExQueryPathXml {

  /**
   * {@inheritdoc}
   */
  protected $encoderClass = 'FeedsExHtmlEncoder';

  /**
   * {@inheritdoc}
   */
  protected function setUp(FeedsSource $source, FeedsFetcherResult $fetcher_result) {

    // Change some parser settings.
    $this->queryPathOptions['use_parser'] = 'html';
  }

  /**
   * {@inheritdoc}
   */
  protected function getRawValue(QueryPath $node) {
    return $node
      ->html();
  }

  /**
   * {@inheritdoc}
   */
  protected function prepareDocument(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
    $raw = $this
      ->prepareRaw($fetcher_result);
    if ($this->config['use_tidy'] && extension_loaded('tidy')) {
      $raw = tidy_repair_string($raw, $this
        ->getTidyConfig(), 'utf8');
    }
    return FeedsExXmlUtility::createHtmlDocument($raw);
  }

  /**
   * {@inheritdoc}
   */
  protected function getTidyConfig() {
    return array(
      'merge-divs' => FALSE,
      'merge-spans' => FALSE,
      'join-styles' => FALSE,
      'drop-empty-paras' => FALSE,
      'wrap' => 0,
      'tidy-mark' => FALSE,
      'escape-cdata' => TRUE,
      'word-2000' => TRUE,
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FeedsExBase::$encoder protected property The encoder used to convert encodings.
FeedsExBase::$messenger protected property The object used to display messages to the user.
FeedsExBase::debug protected function Renders our debug messages into a list.
FeedsExBase::executeSources protected function Executes the source expressions.
FeedsExBase::getEncoder public function Returns the encoder.
FeedsExBase::getFormHeader protected function Returns the configuration form table header.
FeedsExBase::getMappingSources public function
FeedsExBase::getMessenger public function Returns the messenger.
FeedsExBase::hasConfigForm public function
FeedsExBase::hasConfigurableContext protected function Returns whether or not this parser uses a context query. 2
FeedsExBase::hasSourceConfig public function
FeedsExBase::loadLibrary protected function Loads the necessary library. 2
FeedsExBase::logErrors protected function Logs errors.
FeedsExBase::parse public function
FeedsExBase::parseItems protected function Performs the actual parsing. 2
FeedsExBase::prepareExpressions protected function Prepares the expressions for parsing.
FeedsExBase::prepareRaw protected function Prepares the raw string for parsing.
FeedsExBase::prepareVariables protected function Prepares the variable map used to substitution.
FeedsExBase::printErrors protected function Prints errors to the screen.
FeedsExBase::setEncoder public function Sets the encoder.
FeedsExBase::setMessenger public function Sets the messenger to be used to display messages.
FeedsExBase::sourceDefaults public function
FeedsExBase::sourceForm public function
FeedsExBase::sourceFormValidate public function
FeedsExBase::sourceSave public function
FeedsExQueryPathHtml::$encoderClass protected property The class used as the text encoder. Overrides FeedsExXml::$encoderClass
FeedsExQueryPathHtml::getRawValue protected function Returns the raw value. Overrides FeedsExQueryPathXml::getRawValue
FeedsExQueryPathHtml::getTidyConfig protected function Returns the options for phptidy. Overrides FeedsExXml::getTidyConfig
FeedsExQueryPathHtml::prepareDocument protected function Prepares the DOM document. Overrides FeedsExXml::prepareDocument
FeedsExQueryPathHtml::setUp protected function Allows subclasses to prepare for parsing. Overrides FeedsExXml::setUp
FeedsExQueryPathXml::$queryPathOptions protected property Options passed to QueryPath.
FeedsExQueryPathXml::configFormTableColumn protected function Returns a form element for a specific column. Overrides FeedsExXml::configFormTableColumn
FeedsExQueryPathXml::configFormTableHeader protected function Reuturns the list of table headers. Overrides FeedsExXml::configFormTableHeader
FeedsExQueryPathXml::executeContext protected function Returns rows to be parsed. Overrides FeedsExXml::executeContext
FeedsExQueryPathXml::executeSourceExpression protected function Executes a single source expression. Overrides FeedsExXml::executeSourceExpression
FeedsExQueryPathXml::validateExpression protected function Validates an expression. Overrides FeedsExXml::validateExpression
FeedsExXml::$entityLoader protected property The previous value for the entity loader.
FeedsExXml::$handleXmlErrors protected property The previous value for XML error handling.
FeedsExXml::$xpath protected property The FeedsExXpathDomXpath object used for parsing.
FeedsExXml::cleanUp protected function Allows subclasses to cleanup after parsing. Overrides FeedsExBase::cleanUp
FeedsExXml::configDefaults public function Overrides FeedsExBase::configDefaults
FeedsExXml::configForm public function Overrides FeedsExBase::configForm
FeedsExXml::configFormValidate public function Overrides FeedsExBase::configFormValidate
FeedsExXml::getErrors protected function Returns the errors after parsing. Overrides FeedsExBase::getErrors
FeedsExXml::getInnerXml protected function Returns the inner XML of a DOM node.
FeedsExXml::getRaw protected function Returns the raw XML of a DOM node. 1
FeedsExXml::startErrorHandling protected function Starts internal error handling. Overrides FeedsExBase::startErrorHandling
FeedsExXml::stopErrorHandling protected function Stops internal error handling. Overrides FeedsExBase::stopErrorHandling