function endElementHandler($parser, $name)
 {
     $support_tags = array('SUBJECT', 'DESCRIPTION', 'PUBLISHER', 'CONTRIBUTOR', 'DATE', 'TYPE', 'FORMAT', 'IDENTIFIER', 'SOURCE', 'LANGUAGE', 'RELATION', 'COVERAGE', 'RIGHTS');
     if (isset($this->tagstack[3]) && $this->getElementName($this->tagstack[3]) == 'HEADER' || !in_array($this->getElementName(end($this->tagstack)), $support_tags)) {
         parent::endElementHandler($parser, $name);
     } else {
         if ($this->getElementName(end($this->tagstack)) == 'DATE') {
             $this->_creation_date = $this->_cdata_buf;
             $this->search_text[] = $this->_cdata_buf;
             $this->addMetadataField(end($this->tagstack), $this->_cdata_buf, XOONIPS_METADATA_CATEGORY_CREATION_DATE);
             array_pop($this->tagstack);
         } else {
             if ($this->getElementName(end($this->tagstack)) == 'IDENTIFIER') {
                 $result = preg_match("/^(s?https?:\\/\\/" . "[-_.!~*'\\(\\)a-zA-Z0-9;\\/?:\\@&=+\$,%#]+)/", $this->_cdata_buf);
                 if (1 == $result) {
                     $this->_resource_url[] = $this->_cdata_buf;
                     $this->addMetadataField(end($this->tagstack), $this->_cdata_buf, XOONIPS_METADATA_CATEGORY_RESOURCE_LINK);
                 } else {
                     $this->addMetadataField(end($this->tagstack), $this->_cdata_buf);
                 }
                 array_pop($this->tagstack);
             } else {
                 $this->addMetadataField(end($this->tagstack), $this->_cdata_buf);
                 array_pop($this->tagstack);
             }
         }
     }
 }
 function endElementHandler($parser, $name)
 {
     if (isset($this->tagstack[3]) && $this->getElementName($this->tagstack[3]) == 'HEADER' || !in_array($this->getElementName(end($this->tagstack)), $this->_support_tags)) {
         parent::endElementHandler($parser, $name);
     } else {
         if ($this->getElementName(end($this->tagstack)) == 'DATE') {
             $this->_creation_date = $this->_cdata_buf;
             $this->search_text[] = $this->_cdata_buf;
             $this->addMetadataField(end($this->tagstack), $this->_cdata_buf, XOONIPS_METADATA_CATEGORY_DATE);
             array_pop($this->tagstack);
         } else {
             if ($this->getElementName(end($this->tagstack)) == 'DATEOFISSUED') {
                 $this->_date = $this->_cdata_buf;
                 $this->search_text[] = $this->_cdata_buf;
                 $this->addMetadataField(end($this->tagstack), $this->_cdata_buf, XOONIPS_METADATA_CATEGORY_CREATION_DATE);
                 array_pop($this->tagstack);
             } else {
                 if ($this->getElementName(end($this->tagstack)) == 'URI') {
                     $this->_resource_url[] = $this->_cdata_buf;
                     $this->search_text[] = $this->_cdata_buf;
                     $this->addMetadataField(end($this->tagstack), $this->_cdata_buf, XOONIPS_METADATA_CATEGORY_RESOURCE_LINK);
                     array_pop($this->tagstack);
                 } else {
                     $this->addMetadataField(end($this->tagstack), $this->_cdata_buf);
                     array_pop($this->tagstack);
                 }
             }
         }
     }
 }
 function endElementHandler($parser, $name)
 {
     if (isset($this->tagstack[3]) && $this->getElementName($this->tagstack[3]) == 'HEADER' || !in_array($this->getElementName(end($this->tagstack)), $this->_support_tags)) {
         parent::endElementHandler($parser, $name);
     } else {
         if ($this->getElementName(end($this->tagstack)) == 'DATE.MODIFIED') {
             $this->_last_update_date = $this->_cdata_buf;
             $this->search_text[] = $this->_cdata_buf;
             $this->addMetadataField(end($this->tagstack), $this->_cdata_buf, XOONIPS_METADATA_CATEGORY_LAST_UPDATE_DATE);
             array_pop($this->tagstack);
         } else {
             if ($this->getElementName(end($this->tagstack)) == 'DATE.CREATED') {
                 $this->_creation_date = $this->_cdata_buf;
                 $this->search_text[] = $this->_cdata_buf;
                 $this->addMetadataField(end($this->tagstack), $this->_cdata_buf, XOONIPS_METADATA_CATEGORY_CREATION_DATE);
                 array_pop($this->tagstack);
             } else {
                 if ($this->getElementName(end($this->tagstack)) == 'DATE') {
                     $this->_date = $this->_cdata_buf;
                     $this->search_text[] = $this->_cdata_buf;
                     $this->addMetadataField(end($this->tagstack), $this->_cdata_buf, XOONIPS_METADATA_CATEGORY_DATE);
                     array_pop($this->tagstack);
                 } else {
                     if ($this->getElementName(end($this->tagstack)) == 'IDENTIFIER' && $this->_identifierTypeAttr == 'URL') {
                         $this->_resource_url[] = $this->_cdata_buf;
                         $this->search_text[] = $this->_cdata_buf;
                         $this->addMetadataField(end($this->tagstack), $this->_cdata_buf, XOONIPS_METADATA_CATEGORY_RESOURCE_LINK);
                         array_pop($this->tagstack);
                     } else {
                         $this->addMetadataField(end($this->tagstack), $this->_cdata_buf);
                         array_pop($this->tagstack);
                     }
                 }
             }
         }
     }
 }