cvs: pear /XML_Parser/Parser Simple.php
| From: | Stephan Schmidt | Date: | Tue, 18 Jan 2005 20:11:02 +0000 |
| Subject: | cvs: pear /XML_Parser/Parser Simple.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-28668@lists.php.net to get a copy of this message | ||
schst Tue Jan 18 15:11:02 2005 EDT
Modified files:
/pear/XML_Parser/Parser Simple.php
Log:
fixed bug whith additional handlers
http://cvs.php.net/diff.php/pear/XML_Parser/Parser/Simple.php?r1=1.3&r2=1.4&ty=u
Index: pear/XML_Parser/Parser/Simple.php
diff -u pear/XML_Parser/Parser/Simple.php:1.3 pear/XML_Parser/Parser/Simple.php:1.4
--- pear/XML_Parser/Parser/Simple.php:1.3 Tue May 25 09:26:42 2004
+++ pear/XML_Parser/Parser/Simple.php Tue Jan 18 15:11:01 2005
@@ -16,7 +16,7 @@
// | Author: Stephan Schmidt <schst@php-tools.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Simple.php,v 1.3 2004/05/25 13:26:42 schst Exp $
+// $Id: Simple.php,v 1.4 2005/01/18 20:11:01 schst Exp $
/**
* Simple XML parser class.
@@ -103,6 +103,19 @@
var $_depth = 0;
/**
+ * Mapping from expat handler function to class method.
+ *
+ * @var array
+ */
+ var $handler = array(
+ 'default_handler' => 'defaultHandler',
+ 'processing_instruction_handler' => 'piHandler',
+ 'unparsed_entity_decl_handler' => 'unparsedHandler',
+ 'notation_decl_handler' => 'notationHandler',
+ 'external_entity_ref_handler' => 'entityrefHandler'
+ );
+
+ /**
* Creates an XML parser.
*
* This is needed for PHP4 compatibility, it will
@@ -134,15 +147,16 @@
if ($this->mode != 'func' && $this->mode != 'event') {
return $this->raiseError('Unsupported mode given',
XML_PARSER_ERROR_UNSUPPORTED_MODE);
}
- xml_set_object($this->parser, $this);
-
- xml_set_element_handler($this->parser, 'startHandler',
'endHandler');
+ xml_set_object($this->parser, $this->_handlerObj);
+ xml_set_element_handler($this->parser, array(&$this, 'startHandler'),
array(&$this, 'endHandler'));
+ xml_set_character_data_handler($this->parser, array(&$this,
'cdataHandler'));
+
/**
* set additional handlers for character data, entities, etc.
*/
foreach ($this->handler as $xml_func => $method) {
- if (method_exists($this, $method)) {
+ if (method_exists($this->_handlerObj, $method)) {
$xml_func = 'xml_set_' . $xml_func;
$xml_func($this->parser, $method);
}