XML parser callback: Perform an action when an opening tag is encountered.
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).
protected function elementStart($parser, $name, $attributes) {
$name = strtolower($name);
switch ($name) {
case 'image':
case 'textinput':
case 'summary':
case 'tagline':
case 'subtitle':
case 'logo':
case 'info':
$this->element = $name;
break;
case 'id':
case 'content':
if ($this->element != 'item') {
$this->element = $name;
}
case 'link':
// According to RFC 4287, link elements in Atom feeds without a 'rel'
// attribute should be interpreted as though the relation type is
// "alternate".
if (!empty($attributes['HREF']) && (empty($attributes['REL']) || $attributes['REL'] == 'alternate')) {
if ($this->element == 'item') {
$this->items[$this->item]['link'] = $attributes['HREF'];
}
else {
$this->channel['link'] = $attributes['HREF'];
}
}
break;
case 'item':
$this->element = $name;
$this->item += 1;
break;
case 'entry':
$this->element = 'item';
$this->item += 1;
break;
}
$this->tag = $name;
}