function DefaultParser::elementData

XML parser callback: Perform an action when data is encountered.

Parameters

resource $parser: A reference to the XML parser calling the handler.

string $name: The name of the element for which this handler is called.

array $attributes: An associative array with the element's attributes (if any).

File

drupal/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php, line 295
Contains \Drupal\aggregator\Plugin\aggregator\parser\DefaultParser.

Class

DefaultParser
Defines a default parser implementation.

Namespace

Drupal\aggregator\Plugin\aggregator\parser

Code

function elementData($parser, $data) {
  $this->items += array(
    $this->item => array(),
  );
  switch ($this->element) {
    case 'item':
      $this->items[$this->item] += array(
        $this->tag => '',
      );
      $this->items[$this->item][$this->tag] .= $data;
      break;
    case 'image':
    case 'logo':
      $this->image += array(
        $this->tag => '',
      );
      $this->image[$this->tag] .= $data;
      break;
    case 'link':
      if ($data) {
        $this->items[$this->item] += array(
          $tag => '',
        );
        $this->items[$this->item][$this->tag] .= $data;
      }
      break;
    case 'content':
      $this->items[$this->item] += array(
        'content' => '',
      );
      $this->items[$this->item]['content'] .= $data;
      break;
    case 'summary':
      $this->items[$this->item] += array(
        'summary' => '',
      );
      $this->items[$this->item]['summary'] .= $data;
      break;
    case 'tagline':
    case 'subtitle':
      $this->channel += array(
        'description' => '',
      );
      $this->channel['description'] .= $data;
      break;
    case 'info':
    case 'id':
    case 'textinput':

      // The sub-element is not supported. However, we must recognize
      // it or its contents will end up in the item array.
      break;
    default:
      $this->channel += array(
        $this->tag => '',
      );
      $this->channel[$this->tag] .= $data;
  }
}