class FeedsXPathParserHTML in Feeds XPath Parser 6
Same name and namespace in other branches
- 7 FeedsXPathParserHTML.inc \FeedsXPathParserHTML
Parse HTML using XPath.
Hierarchy
- class \FeedsConfigurable
- class \FeedsPlugin implements FeedsSourceInterface
- class \FeedsParser
- class \FeedsXPathParserBase
- class \FeedsXPathParserHTML
- class \FeedsXPathParserBase
- class \FeedsParser
- class \FeedsPlugin implements FeedsSourceInterface
Expanded class hierarchy of FeedsXPathParserHTML
2 string references to 'FeedsXPathParserHTML'
- FeedsXPathParseHTMLTestCase::test in tests/
feeds_xpathparser_parser_html.test - Run tests.
- feeds_xpathparser_feeds_plugins in ./
feeds_xpathparser.module - Implementation of hook_feeds_plugins().
File
- ./
FeedsXPathParserHTML.inc, line 11 - s Provides the FeedsXPathParserHTML class.
View source
class FeedsXPathParserHTML extends FeedsXPathParserBase {
/**
* Implementation of FeedsXPathParserBase::setup().
*/
protected function setup($source_config, FeedsImportBatch $batch) {
if (!empty($source_config['exp']['tidy'])) {
$config = 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,
);
// Default tidy encoding is UTF8.
$encoding = $source_config['exp']['tidy_encoding'];
$raw = tidy_repair_string(trim($batch
->getRaw()), $config, $encoding);
}
else {
$raw = $batch
->getRaw();
}
$doc = new DOMDocument();
// Use our own error handling.
$use = $this
->errorStart();
$success = $doc
->loadHTML($raw);
unset($raw);
$this
->errorStop($use, $source_config['exp']['errors']);
if (!$success) {
throw new Exception(t('There was an error parsing the HTML document.'));
}
return $doc;
}
protected function getRaw(DOMNode $node) {
// DOMDocument::saveHTML() cannot take $node as an argument prior to 5.3.6.
if (version_compare(phpversion(), '5.3.6', '>=')) {
return $this->doc
->saveHTML($node);
}
return $this->doc
->saveXML($node);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FeedsConfigurable:: |
protected | property | ||
FeedsConfigurable:: |
protected | property | CTools export enabled status of this object. | |
FeedsConfigurable:: |
protected | property | ||
FeedsConfigurable:: |
protected | property | ||
FeedsConfigurable:: |
public | function | Similar to setConfig but adds to existing configuration. | 1 |
FeedsConfigurable:: |
public | function | Submission handler for configForm(). | 3 |
FeedsConfigurable:: |
public | function | Copy a configuration. | 1 |
FeedsConfigurable:: |
public | function | Determine whether this object is persistent and enabled. I. e. it is defined either in code or in the database and it is enabled. | 1 |
FeedsConfigurable:: |
public | function | Implementation of getConfig(). | 1 |
FeedsConfigurable:: |
public static | function | Instantiate a FeedsConfigurable object. | 1 |
FeedsConfigurable:: |
public | function | Set configuration. | 1 |
FeedsConfigurable:: |
public | function | Override magic method __get(). Make sure that $this->config goes through getConfig() | |
FeedsConfigurable:: |
public | function | Override magic method __isset(). This is needed due to overriding __get(). | |
FeedsParser:: |
public | function | Clear all caches for results for given source. | |
FeedsParser:: |
public | function | Get an element identified by $element_key of the given item. The element key corresponds to the values in the array returned by FeedsParser::getMappingSources(). | 1 |
FeedsPlugin:: |
public | function |
Returns TRUE if $this->sourceForm() returns a form. Overrides FeedsSourceInterface:: |
|
FeedsPlugin:: |
protected static | function | Loads on-behalf implementations from mappers/ directory. | |
FeedsPlugin:: |
public | function |
Save changes to the configuration of this object.
Delegate saving to parent (= Feed) which will collect
information from this object by way of getConfig() and store it. Overrides FeedsConfigurable:: |
|
FeedsPlugin:: |
public | function |
A source is being deleted. Overrides FeedsSourceInterface:: |
1 |
FeedsPlugin:: |
public | function |
A source is being saved. Overrides FeedsSourceInterface:: |
1 |
FeedsPlugin:: |
protected | function |
Constructor. Overrides FeedsConfigurable:: |
|
FeedsXPathParserBase:: |
protected | property | ||
FeedsXPathParserBase:: |
protected | property | ||
FeedsXPathParserBase:: |
protected | property | ||
FeedsXPathParserBase:: |
protected | property | ||
FeedsXPathParserBase:: |
public | function |
Define defaults. Overrides FeedsConfigurable:: |
|
FeedsXPathParserBase:: |
public | function |
Override parent::configForm(). Overrides FeedsConfigurable:: |
|
FeedsXPathParserBase:: |
public | function |
Override parent::sourceFormValidate(). Overrides FeedsConfigurable:: |
|
FeedsXPathParserBase:: |
protected | function | ||
FeedsXPathParserBase:: |
protected | function | ||
FeedsXPathParserBase:: |
protected | function | Filters mappings, returning the ones that belong to us. | |
FeedsXPathParserBase:: |
public | function |
Override parent::getMappingSources(). Overrides FeedsParser:: |
|
FeedsXPathParserBase:: |
protected | function | ||
FeedsXPathParserBase:: |
public | function |
Implements FeedsParser::parse(). Overrides FeedsParser:: |
|
FeedsXPathParserBase:: |
protected | function | Parses one item from the context array. | |
FeedsXPathParserBase:: |
public | function |
Define defaults. Overrides FeedsPlugin:: |
|
FeedsXPathParserBase:: |
public | function |
Source form. Overrides FeedsPlugin:: |
|
FeedsXPathParserBase:: |
public | function |
Override parent::sourceFormValidate(). Overrides FeedsPlugin:: |
|
FeedsXPathParserHTML:: |
protected | function |
Overrides FeedsXPathParserBase:: |
|
FeedsXPathParserHTML:: |
protected | function |
Implementation of FeedsXPathParserBase::setup(). Overrides FeedsXPathParserBase:: |