本文整理汇总了PHP中xml_set_start_namespace_decl_handler函数的典型用法代码示例。如果您正苦于以下问题:PHP xml_set_start_namespace_decl_handler函数的具体用法?PHP xml_set_start_namespace_decl_handler怎么用?PHP xml_set_start_namespace_decl_handler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xml_set_start_namespace_decl_handler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
function parse()
{
set_error_handler(array(&$this, 'error_handler'));
array_unshift($this->ns_contexts, array());
$parser = xml_parser_create_ns();
xml_set_object($parser, $this);
xml_set_element_handler($parser, "start_element", "end_element");
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_set_character_data_handler($parser, "cdata");
xml_set_default_handler($parser, "_default");
xml_set_start_namespace_decl_handler($parser, "start_ns");
xml_set_end_namespace_decl_handler($parser, "end_ns");
$this->content = '';
$ret = true;
$fp = fopen($this->FILE, "r");
while ($data = fread($fp, 4096)) {
if ($this->debug) {
$this->content .= $data;
}
if (!xml_parse($parser, $data, feof($fp))) {
trigger_error(sprintf(__('XML error: %s at line %d') . "\n", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
$ret = false;
break;
}
}
fclose($fp);
xml_parser_free($parser);
restore_error_handler();
return $ret;
}
示例2: OWLReader
/**
* Constructor
*/
function OWLReader()
{
$this->root_tag = new OWLTag();
$this->parser = xml_parser_create_ns();
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
//KARIM: removed & before "$this->root_tag" since it is not allowed in new versions of PHP
xml_set_object($this->parser, $this->root_tag);
xml_set_element_handler($this->parser, "startTag", "endTag");
xml_set_character_data_handler($this->parser, "characters");
xml_set_start_namespace_decl_handler($this->parser, "namespaceDecl");
}
示例3: XhldXmlAtomParser
function XhldXmlAtomParser($input)
{
$this->parser = xml_parser_create('UTF-8');
xml_set_object($this->parser, $this);
$this->input =& $input;
$this->setCaseFolding(true);
$this->useUtfEncoding();
$this->_parent[0] = '';
xml_set_element_handler($this->parser, "atom_start_element", "atom_end_element");
xml_set_character_data_handler($this->parser, "atom_character_data");
xml_set_start_namespace_decl_handler($this->parser, "atom_ns_start");
xml_set_end_namespace_decl_handler($this->parser, "atom_ns_end");
}
示例4: initXMLParser
/** @ignore */
protected function initXMLParser()
{
if (!isset($this->xmlParser)) {
$parser = xml_parser_create_ns('UTF-8', '');
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler($parser, 'startElementHandler', 'endElementHandler');
xml_set_character_data_handler($parser, 'cdataHandler');
xml_set_start_namespace_decl_handler($parser, 'newNamespaceHandler');
xml_set_object($parser, $this);
$this->xmlParser = $parser;
}
}
示例5: initXMLParser
function initXMLParser()
{
if (!isset($this->xml_parser)) {
$enc = preg_match('/^(utf\\-8|iso\\-8859\\-1|us\\-ascii)$/i', $this->getEncoding(), $m) ? $m[1] : 'UTF-8';
$parser = xml_parser_create($enc);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler($parser, 'open', 'close');
xml_set_character_data_handler($parser, 'cdata');
xml_set_start_namespace_decl_handler($parser, 'nsDecl');
xml_set_object($parser, $this);
$this->xml_parser =& $parser;
}
}
示例6: init
protected final function init()
{
if ($this instanceof Features\IXmlNamespaceParser) {
$this->parser = xml_parser_create_ns('UTF-8');
// Set up start namespace declaration handler
xml_set_start_namespace_decl_handler($this->parser, 'ns_start');
// Set up end namespace declaration handler
xml_set_end_namespace_decl_handler($this->parser, 'ns_end');
} elseif ($this instanceof Features\IXmlBasicParser) {
$this->parser = xml_parser_create('UTF-8');
} else {
throw new \BadMethodCallException('This class does not implements the XML Parser capabilities. Please implement either IXmlBasicParser or IXmlNamespaceParser.');
}
xml_set_object($this->parser, $this);
foreach ($this->options as $option => $value) {
xml_parser_set_option($this->parser, $option, $value);
}
if ($this instanceof Features\IXmlProcessorParser) {
// Set up processing instruction (PI) handler
xml_set_processing_instruction_handler($this->parser, 'pi_handler');
}
if ($this instanceof Features\IXmlEntityHandler) {
// Set up external entity reference handler
xml_set_external_entity_ref_handler($this->parser, 'entity_handler');
}
if ($this instanceof Features\IXmlNdataHandler) {
// Set up notation declaration handler
xml_set_notation_decl_handler($this->parser, 'notation_handler');
// Set up unparsed entity declaration handler
xml_set_unparsed_entity_decl_handler($this->parser, 'ndata_handler');
}
xml_set_element_handler($this->parser, "element_start", "element_end");
xml_set_character_data_handler($this->parser, "cdata_handler");
if ($this instanceof Features\IXmlDefaultHandler) {
if (!defined('ACTIVATE_XML_PARSER_DEFAULT_HANDLER_I_KNOW_WHAT_AM_I_DOING')) {
trigger_error('Active default handler interferes with many XML features like internal parsable entities.', E_USER_WARNING);
}
// Set up default (fallback) handler.
// Warning: Interferes with INTERNAL ENTITY declarations like
// <!ENTITY a 'b'>
xml_set_default_handler($this->parser, "default_handler");
}
}
示例7: rdf_parser_create
/**
* @param string $encoding
* @access private
*/
function rdf_parser_create($encoding)
{
$parser = xml_parser_create_ns($encoding, NAMESPACE_SEPARATOR_CHAR);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
$this->rdf_parser['xml_parser'] = $parser;
xml_set_object($this->rdf_parser['xml_parser'], $this);
xml_set_element_handler($this->rdf_parser['xml_parser'], '_start_element_handler', '_end_element_handler');
xml_set_character_data_handler($this->rdf_parser['xml_parser'], '_character_data_handler');
xml_set_start_namespace_decl_handler($this->rdf_parser['xml_parser'], '_start_ns_declaration_handler');
return $this->rdf_parser;
}
示例8: rss
/**
* Constructs the RSS reader: downloads the URL and parses it. Check $error after constructing.
*
* @param URLPATH The URL to the RSS we will be reading
* @param boolean Whether the 'url' is actually a filesystem path
*/
function rss($url, $is_filesystem_path = false)
{
require_lang('rss');
$this->namespace_stack = array();
$this->tag_stack = array();
$this->attribute_stack = array();
$this->gleamed_feed = array();
$this->gleamed_items = array();
$this->feed_url = $url;
$this->error = NULL;
if (!function_exists('xml_parser_create')) {
$this->error = do_lang_tempcode('XML_NEEDED');
return;
}
if (!$is_filesystem_path && url_is_local($url)) {
$url = get_custom_base_url() . '/' . $url;
}
//echo $url;exit();
if ($is_filesystem_path) {
$GLOBALS['HTTP_CHARSET'] = '';
$data = @file_get_contents($url);
} else {
$GLOBALS['HTTP_CHARSET'] = '';
$data = http_download_file($url, NULL, false);
// if (!is_null($data)) break;
}
if (is_null($data)) {
$this->error = do_lang('RSS_XML_MISSING', $url) . ' [' . $GLOBALS['HTTP_MESSAGE'] . ']';
} else {
// Try and detect feed charset
$exp = '#<\\?xml\\s+version\\s*=\\s*["\'][\\d\\.]+["\']\\s*(encoding\\s*=\\s*["\']([^"\'<>]+)["\'])?\\s*(standalone\\s*=\\s*["\']([^"\'<>]+)["\'])?\\s*\\?' . '>#';
$matches = array();
if (preg_match($exp, $data, $matches) != 0 && array_key_exists(2, $matches)) {
$GLOBALS['HTTP_CHARSET'] = $matches[2];
if (strtolower($GLOBALS['HTTP_CHARSET']) == 'windows-1252') {
$GLOBALS['HTTP_CHARSET'] = 'ISO-8859-1';
}
}
// Weed out if isn't supported
if (is_null($GLOBALS['HTTP_CHARSET']) || !in_array(strtoupper($GLOBALS['HTTP_CHARSET']), array('ISO-8859-1', 'US-ASCII', 'UTF-8'))) {
$GLOBALS['HTTP_CHARSET'] = 'UTF-8';
}
// Our internal charset
$parser_charset = get_charset();
if (!in_array(strtoupper($parser_charset), array('ISO-8859-1', 'US-ASCII', 'UTF-8'))) {
$parser_charset = 'UTF-8';
}
// Create and setup our parser
$xml_parser = function_exists('xml_parser_create_ns') ? @xml_parser_create_ns($GLOBALS['HTTP_CHARSET']) : @xml_parser_create($GLOBALS['HTTP_CHARSET']);
if ($xml_parser === false) {
$this->error = do_lang_tempcode('XML_PARSING_NOT_SUPPORTED');
return;
// PHP5 default build on windows comes with this function disabled, so we need to be able to escape on error
}
xml_set_object($xml_parser, $this);
@xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, $parser_charset);
xml_set_element_handler($xml_parser, 'startElement', 'endElement');
xml_set_character_data_handler($xml_parser, 'startText');
//xml_set_external_entity_ref_handler($xml_parser,'extEntity');
if (function_exists('xml_set_start_namespace_decl_handler')) {
xml_set_start_namespace_decl_handler($xml_parser, 'startNamespace');
}
if (function_exists('xml_set_end_namespace_decl_handler')) {
xml_set_end_namespace_decl_handler($xml_parser, 'endNameSpace');
}
//$data=convert_to_internal_encoding($data); xml_parser does it for us, and we can't disable it- so run with it instead of our own. Shame as it's inferior.
if (strpos($data, '<!ENTITY') === false) {
$extra_data = "<" . "?xml version=\"1.0\" encoding=\"" . $GLOBALS['HTTP_CHARSET'] . "\" ?" . ">\n<!DOCTYPE atom [\n<!ENTITY nbsp \" \" >\n]>\n";
$data = preg_replace($exp, $extra_data, trim($data));
if ($extra_data != '' && strpos($data, $extra_data) === false) {
$data = $extra_data . $data;
}
if (strtoupper($GLOBALS['HTTP_CHARSET']) == 'ISO-8859-1' || strtoupper($GLOBALS['HTTP_CHARSET']) == 'UTF-8') {
$table = array_flip(get_html_translation_table(HTML_ENTITIES));
if (strtoupper($GLOBALS['HTTP_CHARSET']) == 'UTF-8') {
foreach ($table as $x => $y) {
$table[$x] = utf8_encode($y);
}
}
unset($table['&']);
unset($table['>']);
unset($table['<']);
$data = strtr($data, $table);
}
$convert_bad_entities = true;
} else {
$convert_bad_entities = false;
if (strpos($data, "<" . "?xml") === false) {
$data = "<" . "?xml version=\"1.0\" encoding=\"" . $GLOBALS['HTTP_CHARSET'] . "\" ?" . ">" . $data;
}
$data = preg_replace($exp, "<" . "?xml version=\"1.0\" encoding=\"" . $GLOBALS['HTTP_CHARSET'] . "\" ?" . ">", $data);
// Strip out internal encoding (we already detected and sanitised it)
}
$data = unixify_line_format($data, $GLOBALS['HTTP_CHARSET']);
//.........这里部分代码省略.........
示例9: _getXmlParser
private function _getXmlParser()
{
if (null === $this->_xmlParser) {
$this->_xmlParser = xml_parser_create_ns(null, '');
// Disable case folding, for we need the uris.
xml_parser_set_option($this->_xmlParser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($this->_xmlParser, XML_OPTION_SKIP_WHITE, 1);
xml_set_default_handler($this->_xmlParser, array($this, '_handleDefault'));
// Set the handler method for namespace definitions
xml_set_start_namespace_decl_handler($this->_xmlParser, array($this, '_handleNamespaceDeclaration'));
//$this->_setNamespaceDeclarationHandler('_handleNamespaceDeclaration');
//xml_set_end_namespace_decl_handler($xmlParser, array(&$this, '_handleNamespaceDeclaration'));
xml_set_character_data_handler($this->_xmlParser, array($this, '_characterData'));
//xml_set_external_entity_ref_handler($this->_xmlParser, array($this, '_handleExternalEntityRef'));
//xml_set_processing_instruction_handler($this->_xmlParser, array($this, '_handleProcessingInstruction'));
//xml_set_unparsed_entity_decl_handler($this->_xmlParser, array($this, '_handleUnparsedEntityDecl'));
xml_set_element_handler($this->_xmlParser, array($this, '_startElement'), array($this, '_endElement'));
}
return $this->_xmlParser;
}
示例10: register
/**
* Register this class with a parser
*
* @param string $namespace (optional)
* @param string $encoding (optional) default into to autodetect based on env
* @param string $separator (optional) the seperator to use for namespace
* @return resource the parser
*/
public function register($encoding = '', $namespace = false, $separator = null)
{
if ($this->parser === null) {
if ($namespace !== null) {
$this->parser = xml_parser_create_ns($encoding, $separator);
} else {
$this->parser = xml_parser_create($encoding);
}
if (!$this->parser) {
throw new RegisterParserFailure('call to xml_parser_create() failed');
}
# set element handler
xml_set_element_handler($this->parser, array($this, "xmlStartTag"), array($this, "xmlEndTag"));
# set CDATA hander
xml_set_character_data_handler($this->parser, array($this, "xmlTagContent"));
# set processing instructions handler
xml_set_processing_instruction_handler($this->parser, array($this, "xmlPI"));
# set the unparsed entity declaration handler
xml_set_unparsed_entity_decl_handler($this->parser, array($this, "xmlUnparsedEntity"));
# set the notation declaration handler function
xml_set_notation_decl_handler($this->parser, array($this, "xmlNotation"));
# set the external entity reference handler function
xml_set_external_entity_ref_handler($this->parser, array($this, "xmlEentityRef"));
# Sets the default handler function
xml_set_default_handler($this->parser, array($this, "xmlDefault"));
# Set a handler to be called when a namespace is declared.
xml_set_start_namespace_decl_handler($this->parser, array($this, "xmlNSStart"));
# Set a handler to be called when leaving the scope of a namespace declaration
xml_set_end_namespace_decl_handler($this->parser, array($this, "xmlNSEnd"));
# turn off case folding to stop element names from being uppercased;
$this->setOption(XML_OPTION_CASE_FOLDING, false);
//$this->setOption(XML_OPTION_SKIP_WHITE, true);
} else {
throw new ParserException('Parser already registered call XML::unregister() first');
}
return $this->parser;
}
示例11: register
/**
*
* @access protected
*/
function register()
{
xml_set_character_data_handler($this->parser, 'character_data');
xml_set_default_handler($this->parser, 'default_data');
xml_set_element_handler($this->parser, 'tag_open', 'tag_close');
xml_set_end_namespace_decl_handler($this->parser, 'end_namespace_decl');
xml_set_external_entity_ref_handler($this->parser, 'external_entity_ref');
xml_set_notation_decl_handler($this->parser, 'notation_decl');
xml_set_processing_instruction_handler($this->parser, 'processing_instruction');
xml_set_start_namespace_decl_handler($this->parser, 'start_namespace_decl');
xml_set_unparsed_entity_decl_handler($this->parser, 'unparsed_entity');
return $this->registered = 1;
}
示例12: create_parser
function create_parser()
{
$parser = xml_parser_create_ns($this->encoding, " ");
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler($parser, "handle_open", "handle_close");
xml_set_character_data_handler($parser, "handle_cdata");
xml_set_start_namespace_decl_handler($parser, "handle_ns_decl");
xml_set_object($parser, $this);
$this->parser = $parser;
}
示例13: init
//.........这里部分代码省略.........
case 'cp1258':
case 'windows-1258':
case '1258':
$encoding = 'Windows-1258';
$use_iconv = true;
break;
// Default to UTF-8
// Default to UTF-8
default:
$encoding = 'UTF-8';
break;
}
} else {
$mp_rss = preg_replace('/<\\?xml(.*)( standalone="no")(.*)\\?>/msiU', '<?xml\\1\\3?>', $mp_rss, 1);
$mp_rss = preg_replace('/<\\?xml(.*)\\?>/msiU', '<?xml\\1 encoding="UTF-8"?>', $mp_rss, 1);
preg_match('/encoding=["|\'](.*)["|\']/Ui', $mp_rss, $match);
$use_iconv = true;
$use_mbstring = true;
$utf8_fail = false;
$encoding = 'UTF-8';
}
$this->encoding = $encoding;
// If function is available and able, convert characters to UTF-8, and overwrite $this->encoding
if (function_exists('iconv') && $use_iconv && iconv($encoding, 'UTF-8', $mp_rss)) {
$mp_rss = iconv($encoding, 'UTF-8//TRANSLIT', $mp_rss);
$mp_rss = str_replace($match[0], 'encoding="UTF-8"', $mp_rss);
$this->encoding = 'UTF-8';
} else {
if (function_exists('mb_convert_encoding') && $use_mbstring) {
$mp_rss = mb_convert_encoding($mp_rss, 'UTF-8', $encoding);
$mp_rss = str_replace($match[0], 'encoding="UTF-8"', $mp_rss);
$this->encoding = 'UTF-8';
} else {
if (($use_mbstring || $use_iconv) && $utf8_fail) {
$this->encoding = 'UTF-8';
$mp_rss = str_replace($match[0], 'encoding="UTF-8"', $mp_rss);
}
}
}
$mp_rss = preg_replace('/<(.*)>[\\s]*<\\!\\[CDATA\\[/msiU', '<\\1 spencoded="false"><![CDATA[', $mp_rss);
// Add an internal attribute to CDATA sections
$mp_rss = str_replace(']] spencoded="false">', ']]>', $mp_rss);
// Remove it when we're on the end of a CDATA block (therefore making it ill-formed)
// If we're RSS
if (preg_match('/<rdf:rdf/i', $mp_rss) || preg_match('/<rss/i', $mp_rss)) {
$sp_elements = array('author', 'link');
// Or if we're Atom
} else {
$sp_elements = array('content', 'copyright', 'name', 'subtitle', 'summary', 'tagline', 'title');
}
foreach ($sp_elements as $full) {
// The (<\!\[CDATA\[)? never matches any CDATA block, therefore the CDATA gets added, but never replaced
$mp_rss = preg_replace("/<{$full}(.*)>[\\s]*(<\\!\\[CDATA\\[)?(.*)(]]>)?[\\s]*<\\/{$full}>/msiU", "<{$full}\\1><![CDATA[\\3]]></{$full}>", $mp_rss);
// The following line is a work-around for the above bug
$mp_rss = preg_replace("/<{$full}(.*)><\\!\\[CDATA\\[[\\s]*<\\!\\[CDATA\\[/msiU", "<{$full}\\1><![CDATA[", $mp_rss);
// Deal with CDATA within CDATA (this can be caused by us inserting CDATA above)
$mp_rss = preg_replace_callback("/<({$full})(.*)><!\\[CDATA\\[(.*)\\]\\]><\\/{$full}>/msiU", array(&$this, 'cdata_in_cdata'), $mp_rss);
}
// If XML Dump is enabled, send feed to the page and quit.
if ($this->xml_dump) {
header("Content-type: text/xml; charset=" . $this->encoding);
echo $mp_rss;
exit;
}
$this->xml = xml_parser_create_ns($this->encoding);
$this->namespaces = array('xml' => 'HTTP://WWW.W3.ORG/XML/1998/NAMESPACE', 'atom' => 'ATOM', 'rss2' => 'RSS', 'rdf' => 'RDF', 'rss1' => 'RSS', 'dc' => 'DC', 'xhtml' => 'XHTML', 'content' => 'CONTENT');
xml_parser_set_option($this->xml, XML_OPTION_SKIP_WHITE, 1);
xml_set_object($this->xml, $this);
xml_set_character_data_handler($this->xml, 'dataHandler');
xml_set_element_handler($this->xml, 'startHandler', 'endHandler');
xml_set_start_namespace_decl_handler($this->xml, 'startNameSpace');
xml_set_end_namespace_decl_handler($this->xml, 'endNameSpace');
if (xml_parse($this->xml, $mp_rss)) {
xml_parser_free($this->xml);
$this->parse_xml_data_array();
$this->data['feedinfo']['encoding'] = $this->encoding;
if ($this->order_by_date && !empty($this->data['items'])) {
usort($this->data['items'], create_function('$a,$b', 'if ($a->date == $b->date) return 0; return ($a->date < $b->date) ? 1 : -1;'));
}
if ($this->caching && substr($this->rss_url, 0, 7) == 'http://') {
if ($this->is_writeable_createable($cache_filename)) {
$fp = fopen($cache_filename, 'w');
fwrite($fp, serialize($this->data));
fclose($fp);
} else {
trigger_error("{$cache_filename} is not writeable", E_USER_WARNING);
}
}
return true;
} else {
$this->sp_error(sprintf('XML error: %s at line %d, column %d', xml_error_string(xml_get_error_code($this->xml)), xml_get_current_line_number($this->xml), xml_get_current_column_number($this->xml)), E_USER_WARNING, __FILE__, __LINE__);
xml_parser_free($this->xml);
$this->data = array();
return false;
}
}
} else {
return false;
}
}
示例14: Aspis_xml_set_start_namespace_decl_handler
function Aspis_xml_set_start_namespace_decl_handler($parser, $handler)
{
global $Aspis_xml_objects;
if (!empty($Aspis_xml_objects)) {
$c = count($Aspis_xml_objects);
for ($i = $c - 1; $i >= 0; $i--) {
$e = $Aspis_xml_objects[$i];
if ($e[0] === $parser[0]) {
$handler[0] = AspisInternalCallback(array(array(array($e[1], false), array($handler[0], false)), false));
break;
}
}
}
return array(xml_set_start_namespace_decl_handler($parser[0], $handler[0]), false);
}
示例15: parse
/**
* Parses xml text using Expat
* @param Object A reference to the DOM document that the xml is to be parsed into
* @param string The text to be parsed
* @param boolean True if CDATA Section nodes are not to be converted into Text nodes
* @return boolean True if the parsing is successful
*/
function parse(&$myXMLDoc, $xmlText, $preserveCDATA = true)
{
$this->xmlDoc =& $myXMLDoc;
$this->lastChild =& $this->xmlDoc;
$this->preserveCDATA = $preserveCDATA;
//create instance of expat parser (should be included in php distro)
if (version_compare(phpversion(), '5.0', '<=')) {
if ($this->xmlDoc->isNamespaceAware) {
$parser = xml_parser_create_ns('');
} else {
$parser = xml_parser_create('');
}
} else {
if ($this->xmlDoc->isNamespaceAware) {
$parser = xml_parser_create_ns();
} else {
$parser = xml_parser_create();
}
}
//set handlers for SAX events
xml_set_object($parser, $this);
xml_set_character_data_handler($parser, 'dataElement');
xml_set_default_handler($parser, 'defaultDataElement');
xml_set_notation_decl_handler($parser, 'notationElement');
xml_set_processing_instruction_handler($parser, 'processingInstructionElement');
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
if ($this->xmlDoc->isNamespaceAware) {
xml_set_start_namespace_decl_handler($parser, 'startNamespaceDeclaration');
xml_set_end_namespace_decl_handler($parser, 'endNamespaceDeclaration');
xml_set_element_handler($parser, 'startElementNS', 'endElement');
$this->namespaceURIMap[DOMIT_XML_NAMESPACE] = 'xml';
} else {
xml_set_element_handler($parser, 'startElement', 'endElement');
}
//parse out whitespace - (XML_OPTION_SKIP_WHITE = 1 does not
//seem to work consistently across versions of PHP and Expat
$xmlText = eregi_replace('>' . "[[:space:]]+" . '<', '><', $xmlText);
$success = xml_parse($parser, $xmlText);
$this->xmlDoc->errorCode = xml_get_error_code($parser);
$this->xmlDoc->errorString = xml_error_string($this->xmlDoc->errorCode);
xml_parser_free($parser);
return $success;
}