protected function FeedsQueryPathParser::parseSourceElement in Feeds QueryPath Parser 6
Same name and namespace in other branches
- 7 FeedsQueryPathParser.inc \FeedsQueryPathParser::parseSourceElement()
1 call to FeedsQueryPathParser::parseSourceElement()
- FeedsQueryPathParser::parse in ./
FeedsQueryPathParser.inc - Implementation of FeedsParser::parse().
File
- ./
FeedsQueryPathParser.inc, line 59 - Provides the class for FeedsQueryPathParser.
Class
- FeedsQueryPathParser
- @file
Code
protected function parseSourceElement($item, $query, $source) {
$attr = $this->source_config['attrs'][$source];
if ($query == '' && $attr == '') {
return;
}
if ($query != '') {
$item = qp($item, $query);
}
$values = array();
foreach ($item as $i) {
if ($attr != '') {
$values[] = $i
->attr($attr);
}
elseif (in_array($source, $this->rawXML)) {
$values[] = $i
->html();
}
else {
$values[] = $i
->text();
}
}
$this
->debug($values, $source);
return count($values) <= 1 ? reset($values) : $values;
}