Index: Parser.php =================================================================== RCS file: /repository/pear/XML_Parser/Parser.php,v retrieving revision 1.25 diff -u -r1.25 Parser.php --- Parser.php 25 Mar 2005 17:13:10 -0000 1.25 +++ Parser.php 4 May 2005 10:22:04 -0000 @@ -130,6 +130,15 @@ var $mode; /** + * Whether to add namespace support + * + * If set to true, the parser will be namespace aware + * + * @var boolan + */ + var $nssupport; + + /** * Mapping from expat handler function to class method. * * @var array @@ -179,10 +188,11 @@ * startelement/endelement-type events, "func" * to have it call functions named after elements * @param string $tgenc a valid target encoding + * @param boolean $nssupport whether to support namespaces */ - function XML_Parser($srcenc = null, $mode = 'event', $tgtenc = null) + function XML_Parser($srcenc = null, $mode = 'event', $tgtenc = null, $nssupport = false) { - XML_Parser::__construct($srcenc, $mode, $tgtenc); + XML_Parser::__construct($srcenc, $mode, $tgtenc, $nssupport); } // }}} @@ -195,14 +205,16 @@ * startelement/endelement-type events, "func" * to have it call functions named after elements * @param string $tgenc a valid target encoding + * @param boolean $nssupport whether to support namespaces */ - function __construct($srcenc = null, $mode = 'event', $tgtenc = null) + function __construct($srcenc = null, $mode = 'event', $tgtenc = null, $nssupport = false) { $this->PEAR('XML_Parser_Error'); $this->mode = $mode; $this->srcenc = $srcenc; $this->tgtenc = $tgtenc; + $this->nssupport = $nssupport; } // }}} @@ -315,9 +327,9 @@ function _create() { if ($this->srcenc === null) { - $xp = @xml_parser_create(); + $xp = $this->nssupport ? @xml_parser_create_ns() : @xml_parser_create(); } else { - $xp = @xml_parser_create($this->srcenc); + $xp = $this->nssupport ? @xml_parser_create_ns($this->srcenc) : @xml_parser_create($this->srcenc); } if (is_resource($xp)) { if ($this->tgtenc !== null) {