46 $this->parser = xml_parser_create(
'UTF-8');
47 xml_set_object($this->parser, $this);
48 $this->input = $input;
51 xml_set_element_handler($this->parser,
'handleBeginElement',
'handleEndElement');
52 xml_set_character_data_handler($this->parser,
'handleCharacterData');
53 xml_set_processing_instruction_handler($this->parser,
'handleProcessingInstruction');
54 xml_set_default_handler($this->parser,
'handleDefault');
55 xml_set_unparsed_entity_decl_handler($this->parser,
'handleUnparsedEntityDecl');
56 xml_set_notation_decl_handler($this->parser,
'handleNotationDecl');
57 xml_set_external_entity_ref_handler($this->parser,
'handleExternalEntityRef');
78 assert(is_bool($isCaseFolding));
81 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, $this->isCaseFolding);
89 $this->targetEncoding =
'ISO-8859-1';
90 xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->targetEncoding);
98 $this->targetEncoding =
'US-ASCII';
99 xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->targetEncoding);
107 $this->targetEncoding =
'UTF-8';
108 xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->targetEncoding);
117 return $this->tags[count($this->tags) - 1];
122 if (isset($this->tags[count($this->tags) - 2])) {
123 return $this->tags[count($this->tags) - 2];
138 if (!is_resource($this->input)) {
139 if (!xml_parse($this->parser, $this->input)) {
148 while ($data = fread($this->input, 4096)) {
149 if (!xml_parse($this->parser, str_replace(
"'",
"'", $data), feof($this->input))) {
151 fclose($this->input);
155 fclose($this->input);
165 xml_parser_free($this->parser);
167 if (!method_exists($this,
'__destruct')) {
180 return sprintf(
"XmlParse error: %s at line %d", xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser));
195 if (is_array(
$name)) {
196 foreach (
$name as $n) {
197 $this->tagHandlers[$n] = $tagHandler;
200 $this->tagHandlers[
$name] = $tagHandler;
221 array_push($this->tags, $tagName);
223 if (isset($this->tagHandlers[$tagName]) && is_subclass_of($this->tagHandlers[$tagName],
'xmltaghandler')) {
224 $this->tagHandlers[$tagName]->handleBeginElement($this, $attributesArray);
240 array_pop($this->tags);
241 if (isset($this->tagHandlers[$tagName]) && is_subclass_of($this->tagHandlers[$tagName],
'xmltaghandler')) {
242 $this->tagHandlers[$tagName]->handleEndElement($this);
259 if (null != $tagHandler && is_subclass_of($tagHandler,
'xmltaghandler')) {
260 $tagHandler->handleCharacterData($this, $data);
372 $this->errors[] = trim(
$error);
387 if (count($this->errors) > 0) {
388 foreach ($this->errors as
$error) {
389 $ret .= $error .
'<br />';
handleExternalEntityRef($parser, $openEntityNames, $base, $systemId, $publicId)
if(empty($settings['ROOT_PATH'])) elseif(empty($settings['DB_PARAMETERS'])) $error
addTagHandler(XmlTagHandler &$tagHandler)
handleCharacterData($parser, $data)
handleCharacterDataDefault($parser, $data)
handleBeginElementDefault($parser, $tagName, $attributesArray)
handleDefault($parser, $data)
setCaseFolding($isCaseFolding)
handleEndElement($parser, $tagName)
handleEndElementDefault($parser, $tagName)
handleNotationDecl($parser, $notationName, $base, $systemId, $publicId)
handleUnparsedEntityDecl($parser, $entityName, $base, $systemId, $publicId, $notationName)
handleProcessingInstruction($parser, &$target, &$data)
handleBeginElement($parser, $tagName, $attributesArray)