Is called for text between the start and the end of tags.

Note: Used by xml element handler as callback.

@author Kilian Singer
@param resource $parser The XML parser resource.
@param string $data The XML source to parse.
517011
private function characterdata($parser, $data) {
        $current = &$this->current;
        $level = &$this->level;
        if (($data == "0") || (!empty($data) && trim($data) != "")) {
            $siz = count($current[$level]);
            if ($siz == 0) {
                $current[$level][0] = $data;
            } else {
                $key = max(array_keys($current[$level]));
                if (is_int($key)) {
                    end($current[$level]);
                    if (is_int(key($current[$level]))) { // If last index is nummeric we have CDATA and concat.
                        $current[$level][$key] = $current[$level][$key] . $data;
                    } else {
                        $current[$level][$key + 1] = $data; // Otherwise we make a new key.
                    }
                } else {
                    $current[$level][0] = $data;
                }
            }
        }
    }
575243
public function parse(Parser $parser)
    {
        $parser->match(Lexer::T_IDENTIFIER);
        $parser->match(Lexer::T_OPEN_PARENTHESIS);
        $this->entityLocation = $parser->ArithmeticPrimary();
        $parser->match(Lexer::T_COMMA);
        $this->latitude = $parser->ArithmeticPrimary();
        $parser->match(Lexer::T_COMMA);
        $this->longitude = $parser->ArithmeticPrimary();
        $parser->match(Lexer::T_CLOSE_PARENTHESIS);
    }
843896
public static <T> Parser<T> between(Parser<?> before, Parser<T> parser, Parser<?> after) {
    return parser.between(before, after);
  }
98812
private function _endElement($parser, $name) {
        // end tag was found...
        $parserid = (int) $parser;
        $this->_xmltree[$parserid] = substr($this->_xmltree[$parserid],0, strlen($this->_xmltree[$parserid]) - (strlen($name) + 1));
    }
1219531
private function _delete_startElement($parser, $name, $attrs) {
        // lower XML Names... maybe break a RFC, don't know ...
        $parserid = (int) $parser;
        $propname = strtolower($name);
        $this->_xmltree[$parserid] .= $propname . '_';

        // translate xml tree to a flat array ...
        switch($this->_xmltree[$parserid]) {
        case 'dav::multistatus_dav::response_':
            // new element in mu
            $this->_delete_ref =& $this->_delete[$parserid][];
            break;
        case 'dav::multistatus_dav::response_dav::href_':
            $this->_delete_ref_cdata = &$this->_ls_ref['href'];
            break;

        default:
            // handle unknown xml elements...
            $this->_delete_cdata = &$this->_delete_ref[$this->_xmltree[$parserid]];
        }
    }
41665
function parse() {
    $this->output = '';
    # drop tags
    $this->parser->html = preg_replace('#<('.implode('|', $this->drop).')[^>]*>.*</\\1>#sU', '', $this->parser->html);
    while ($this->parser->nextNode()) {
      switch ($this->parser->nodeType) {
        case 'doctype':
          break;
        case 'pi':
        case 'comment':
          if ($this->keepHTML) {
            $this->flushLinebreaks();
            $this->out($this->parser->node);
            $this->setLineBreaks(2);
          }
          # else drop
          break;
        case 'text':
          $this->handleText();
          break;
        case 'tag':
          if (in_array($this->parser->tagName, $this->ignore)) {
            break;
          }
          if ($this->parser->isStartTag) {
            $this->flushLinebreaks();
          }
          if ($this->skipConversion) {
            $this->isMarkdownable(); # update notConverted
            $this->handleTagToText();
            continue;
          }
          if (!$this->parser->keepWhitespace && $this->parser->isBlockElement && $this->parser->isStartTag) {
            $this->parser->html = ltrim($this->parser->html);
          }
          if ($this->isMarkdownable()) {
            if ($this->parser->isBlockElement && $this->parser->isStartTag && !$this->lastWasBlockTag && !empty($this->output)) {
              if (!empty($this->buffer)) {
                $str =& $this->buffer[count($this->buffer) -1];
              } else {
                $str =& $this->output;
              }
              if (substr($str, -strlen($this->indent)-1) != "\n".$this->indent) {
                $str .= "\n".$this->indent;
              }
            }
            $func = 'handleTag_'.$this->parser->tagName;
            $this->$func();
            if ($this->linksAfterEachParagraph && $this->parser->isBlockElement && !$this->parser->isStartTag && empty($this->parser->openTags)) {
              $this->flushStacked();
            }
            if (!$this->parser->isStartTag) {
              $this->lastClosedTag = $this->parser->tagName;
            }
          } else {
            $this->handleTagToText();
            $this->lastClosedTag = '';
          }
          break;
        default:
          trigger_error('invalid node type', E_USER_ERROR);
          break;
      }
      $this->lastWasBlockTag = $this->parser->nodeType == 'tag' && $this->parser->isStartTag && $this->parser->isBlockElement;
    }
    if (!empty($this->buffer)) {
      trigger_error('buffer was not flushed, this is a bug. please report!', E_USER_WARNING);
      while (!empty($this->buffer)) {
        $this->out($this->unbuffer());
      }
    }
    ### cleanup
    $this->output = rtrim(str_replace('&amp;', '&', str_replace('&lt;', '<', str_replace('&gt;', '>', $this->output))));
    # end parsing, flush stacked tags
    $this->flushStacked();
    $this->stack = array();
  }
565902
protected function start($parser, $tag, $attributes)
    {
        //Set the tag as lower case, for consistency
        $tag = strtolower($tag);

        //Update the current path
        $this->currentPath .= $tag.'/';

        $this->fireCurrentAttributesCallbacks($attributes);

        //Go through each callback and ensure that path data has been
        //started for it
        foreach ($this->callbacks as $path => $callbacks) {
            if ($path === $this->currentPath) {
                $this->pathData[$this->currentPath] = '';
            }
        }

        //Generate the tag, with attributes. Attribute names are also lower
        //cased, for consistency
        $data = '<'.$tag;
        foreach ($attributes as $key => $val) {
            $options = ENT_QUOTES;
            if (defined('ENT_XML1')) {
                $options |= ENT_XML1;
            }

            $val   = htmlentities($val, $options, "UTF-8");
            $data .= ' '.strtolower($key).'="'.$val.'"';

            if (stripos($key, 'xmlns:') !== false) {
                $key = strtolower($key);
                $key = str_replace('xmlns:', '', $key);
                $this->namespaces[strtolower($key)] = $val;
            }
        }
        $data .= '>';

        //Add the data to the path data required
        $this->addData($parser, $data);

        return $parser;
    }
301087
final protected function parseRow(): void
    {
        // only parse the next row if only one in buffer
        if (\count($this->bufferedRow) > 1) {
            return;
        }
        if (feof($this->file)) {
            $this->currentRow = null;

            return;
        }

        $this->currentRowEnded = false;
        // read file until row is ended
        while (!$this->currentRowEnded && !feof($this->file)) {
            $data = fread($this->file, 1024);
            xml_parse($this->parser, $data);
        }
    }
404367
public function parse($data)
    {
        if (!empty($data)) {
            //$data = eregi_replace(">"."[[:space:]]+"."< ",">< ",$data);
            $data = preg_replace("/>\s+</i", '><', $data);
            if (!xml_parse($this->parser, $data, true)) {
                $this->xmlParsingError = '';
                $this->xmlParsingError = xml_error_string(xml_get_error_code($this->parser));
                $this->xmlParsingError .= xml_get_current_line_number($this->parser);

                return false;
            //+++ die($reason);
            } else {
                return true;
            }
        } else {
            $this->xmlParsingError = 'No data to parse!';

            return false;
        }
    }
305910
protected function parseString($parser, $data, $isFinal)
    {
        if (!xml_parse($parser, $data, $isFinal)) {
            throw new Exception(
                xml_error_string(xml_get_error_code($parser))
                .' At line: '.
                xml_get_current_line_number($parser)
            );
        }

        return $parser;
    }
884329
function _stop_element_handler($parser, $name)
    {
        if (isset($this->current)) {
            $this->current = new BigInteger(base64_decode($this->current), 256);
            unset($this->current);
        }
    }
1081935
protected function tag_close($parser, $tag) {
        switch ($tag) {
            case 'moodle_database' :
                $this->finish_database_import();
                break;

            case 'table' :
                $this->finish_table_import($this->current_table);
                $this->current_table = null;
                break;

            case 'record' :
                $this->import_table_data($this->current_table, $this->current_row);
                $this->current_row = null;
                break;

            case 'field' :
                $field = $this->current_field;
                if ($this->current_data_is_null) {
                    $this->current_row->$field = null;
                } else {
                    $this->current_row->$field = $this->current_data;
                }
                $this->current_field        = null;
                $this->current_data         = null;
                $this->current_data_is_null = null;
                break;

            default :
                throw new dbtransfer_exception('malformedxmlexception');
        }
    }
593970
public void parseReader(Reader reader) throws ParserException, IOException {

        try {
            nanoElement.parseFromReader(reader);
        } catch (XMLParseException e) {
            throw new ParserException(e.getMessage());
        }
    }
808059
function _tag_close( &$parser, $tag ) {
		$this->currentElement = '';

		switch( strtoupper( $tag ) ) {
			case 'DATA':
				xml_set_object( $parser, $this->parent );
				break;
		}
	}
140328
public function escapeHandler(&$parser, $data) {
        if (strpos($data, '--') === 0) {
            $this->tokens[] = new HTMLPurifier_Token_Comment($data);
        }
        // CDATA is handled elsewhere, but if it was handled here:
        //if (strpos($data, '[CDATA[') === 0) {
        //    $this->tokens[] = new HTMLPurifier_Token_Text(
        //        substr($data, 7, strlen($data) - 9) );
        //}
        return true;
    }
123665
public function startDocument($data)
    {
        $this->checkStartDocument($data);

        $this->isEmpty = true;

        $this->xmlWriter = new \XMLWriter();
        $this->xmlWriter->openMemory();
        $this->xmlWriter->setIndent($this->formatOutput);
        $this->xmlWriter->startDocument('1.0', 'UTF-8');
    }
29394
protected function _cbElementStart($parser, $name, Array $attributes)
	{
		$idx = xml_get_current_byte_index($this->_parser);
		
		$this->_empty = $this->_buffer[$idx - $this->_offset] == '/';
		
		$attrs = "";
		foreach ($attributes as $key => $val) {
			$attrs .= " " . $key . "=\"" . $val . "\"";
		}
		
		fwrite($this->_output, $this->_getPaddingStr() . "<" . $name . $attrs . ($this->_empty ? ' />' : '>') . "\n");
		
		if (!$this->_empty) ++$this->_depth;
	}