abstract class FeedImportDomXPathReader in Feed Import 8
This class provides a helper for dom xpath queries.
Hierarchy
- class \Drupal\feed_import_base\FeedImportConfigurable
- class \Drupal\feed_import_base\FeedImportReader
- class \Drupal\feed_import_base\FeedImportDomXPathReader
- class \Drupal\feed_import_base\FeedImportReader
Expanded class hierarchy of FeedImportDomXPathReader
File
- feed_import_base/
src/ FeedImportDomXPathReader.php, line 7
Namespace
Drupal\feed_import_baseView source
abstract class FeedImportDomXPathReader extends FeedImportReader {
// DomXPath instance
protected $xpath;
// Bool, see DomXPath::evaluate
protected $xpathRegisterNodeNS = TRUE;
/**
* {@inheritdoc}
*/
public function map(&$item, &$path) {
$values = $this->xpath
->evaluate($path, $item, $this->xpathRegisterNodeNS);
if ($values instanceof DOMNodeList) {
if (!($len = $values->length)) {
return NULL;
}
elseif ($len == 1) {
return $values
->item(0)->nodeValue;
}
$i = 0;
$ret = array();
while ($i < $len) {
$ret[] = $values
->item($i++)->nodeValue;
}
return $ret;
}
return $values;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FeedImportConfigurable:: |
protected | property | ||
FeedImportConfigurable:: |
public static | function | Helper function to get lines of a string | |
FeedImportConfigurable:: |
public | function | Sets options for this instance | 4 |
FeedImportDomXPathReader:: |
protected | property | ||
FeedImportDomXPathReader:: |
protected | property | ||
FeedImportDomXPathReader:: |
public | function |
Returns a value mapped from obj by path. Overrides FeedImportReader:: |
|
FeedImportReader:: |
protected | property | ||
FeedImportReader:: |
public | function | Override this to preprocess your paths before they are used in map(). | 2 |
FeedImportReader:: |
abstract public | function | This method returns the next available item or NULL if there are no items left. | 6 |
FeedImportReader:: |
public | function | Returns a stream context | |
FeedImportReader:: |
abstract public | function | Here you'll init your reader. | 6 |
FeedImportReader:: |
final public | function | Constructor of reader. Constructor is final but you'll have to implement init() to init your reader. | |
FeedImportReader:: |
public | function | Destructor. | 2 |