Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.8

Request #5557 XML_Parser: Unable to create XML parser resource.
Submitted: 2005-09-29 11:36 UTC
From: vit at vit dot pp dot ru Assigned: schst
Status: Closed Package: XML_Parser
PHP Version: 4.3.10 OS: Win xp sp2
Roadmaps: (Not assigned)    
Subscription  


 [2005-09-29 11:36 UTC] vit at vit dot pp dot ru
Description: ------------ Hello! probably this is not a bug but i cannot cope with it (( I try to use PEAR:config, which use xml_parser for reading xml configs and xml_util for writing, it writes ok but i have problems with reading it or any other xml (( It throws the following error: XML_Parser: Unable to create XML parser resource. XML Support active XML Namespace Support active EXPAT Version 1.95.6 Please give a hint what can cause such behavior after $root = &$conf->parseConfig('config.xml', 'XML'); print_r of the $root is the following : xml_parser_error Object ( [error_message_prefix] => XML_Parser: [mode] => 1 [level] => 1024 [code] => 200 [message] => Unable to create XML parser resource. [userinfo] => [backtrace] => Array ( [0] => Array ( [file] => d:\home\test2\www\XML\Parser.php [line] => 680 [function] => pear_error [class] => xml_parser_error [type] => -> [args] => Array ( [0] => Unable to create XML parser resource. [1] => 200 [2] => 1 [3] => 1024 ) ) [1] => Array ( [file] => d:\home\test2\www\PEAR.php [line] => 538 [function] => xml_parser_error [class] => xml_parser_error [type] => -> [args] => Array ( [0] => Unable to create XML parser resource. [1] => 200 [2] => 1 [3] => 1024 [4] => ) ) [2] => Array ( [file] => d:\home\test2\www\XML\Parser.php [line] => 568 [function] => raiseerror [class] => pear [type] => :: [args] => Array ( [0] => xml_parser_error Object ( [error_message_prefix] => XML_Parser: [mode] => 1 [level] => 1024 [code] => 200 [message] => Unable to create XML parser resource. [userinfo] => [backtrace] => Array ( [0] => Array ( [file] => d:\home\test2\www\XML\Parser.php [line] => 680 [function] => pear_error [class] => xml_parser_error [type] => -> [args] => Array ( [0] => Unable to create XML parser resource. [1] => 200 [2] => 1 [3] => 1024 ) ) [1] => Array ( [file] => d:\home\test2\www\XML\Parser.php [line] => 567 [function] => xml_parser_error [class] => xml_parser_error [type] => -> [args] => Array ( [0] => Unable to create XML parser resource. [1] => 200 ) ) [2] => Array ( [file] => d:\home\test2\www\XML\Parser.php [line] => 338 [function] => raiseerror [class] => config_container_xml [type] => -> [args] => Array ( [0] => Unable to create XML parser resource. [1] => 200 ) ) [3] => Array ( [file] => d:\home\test2\www\XML\Parser.php [line] => 355 [function] => _create [class] => config_container_xml [type] => -> [args] => Array ( ) ) [4] => Array ( [file] => d:\home\test2\www\XML\Parser.php [line] => 462 [function] => reset [class] => config_container_xml [type] => -> [args] => Array ( ) ) [5] => Array ( [file] => d:\home\test2\www\Config\Container\XML.php [line] => 111 [function] => parse [class] => config_container_xml [type] => -> [args] => Array ( ) ) [6] => Array ( [file] => d:\home\test2\www\Config.php [line] => 197 [function] => parsedatasrc [class] => config_container_xml [type] => -> [args] => Array ( [0] => config.xml [1] => config Object ( [datasrc] => [configType] => [parserOptions] => Array ( ) [container] => config_container Object ( [type] => section [name] => root [content] => [children] => Array ( ) [parent] => [attributes] => [_id] => rootsection433bd0f4ad94b4.39846154 ) ) ) ) [7] => Array ( [file] => d:\home\test2\www\index.php [line] => 14 [function] => parseconfig [class] => config [type] => -> [args] => Array ( [0] => config.xml [1] => XML ) ) ) [callback] => ) ) ) [3] => Array ( [file] => d:\home\test2\www\XML\Parser.php [line] => 338 [function] => raiseerror [class] => config_container_xml [type] => -> [args] => Array ( [0] => Unable to create XML parser resource. [1] => 200 ) ) [4] => Array ( [file] => d:\home\test2\www\XML\Parser.php [line] => 355 [function] => _create [class] => config_container_xml [type] => -> [args] => Array ( ) ) [5] => Array ( [file] => d:\home\test2\www\XML\Parser.php [line] => 462 [function] => reset [class] => config_container_xml [type] => -> [args] => Array ( ) ) [6] => Array ( [file] => d:\home\test2\www\Config\Container\XML.php [line] => 111 [function] => parse [class] => config_container_xml [type] => -> [args] => Array ( ) ) [7] => Array ( [file] => d:\home\test2\www\Config.php [line] => 197 [function] => parsedatasrc [class] => config_container_xml [type] => -> [args] => Array ( [0] => config.xml [1] => config Object ( [datasrc] => [configType] => [parserOptions] => Array ( ) [container] => config_container Object ( [type] => section [name] => root [content] => [children] => Array ( ) [parent] => [attributes] => [_id] => rootsection433bd0f4ad94b4.39846154 ) ) ) ) [8] => Array ( [file] => d:\home\test2\www\index.php [line] => 14 [function] => parseconfig [class] => config [type] => -> [args] => Array ( [0] => config.xml [1] => XML ) ) ) [callback] => ) Error while reading configuration: XML_Parser: Unable to create XML parser resource.

Comments

 [2005-09-29 12:22 UTC] schst
Might be a borked PHP installation. What happens if you run a script like this: <?php $parser = xml_parser_create(); var_dump($parser); ?>
 [2005-09-29 12:29 UTC] vit at vit dot pp dot ru
<?php $parser = xml_parser_create(); var_dump($parser); ?> the result is : resource(4) of type (xml) So this is not Parser problem? more likely it's Config class trouble ?
 [2005-09-29 12:36 UTC] schst
Strange. Which version of XML_Parser are you using? Could you remove the "@" signs in the following code of your XML_Parser installation? if ($this->srcenc === null) { $xp = @xml_parser_create(); } else { $xp = @xml_parser_create($this->srcenc); } They are in the _create() method.
 [2005-09-29 12:53 UTC] vit at vit dot pp dot ru
Oh thanks very much - that helped - it says windows-1251 is unsupported (( Is there any way to handle win1251 encoding?
 [2005-09-29 14:08 UTC] schst
Not that I know of. The supported encodings are listed in the PHP manual: http://de3.php.net/xml_parser_create However, I should probably catch this in XML_Parser and raise a better error.
 [2005-09-29 14:21 UTC] vit at vit dot pp dot ru
>>However, I should probably catch this in XML_Parser and >>raise a better >>error. This would be really great :) Thanks for help PS I coped with the problem, changing (in PEAR::Config) to false the attribute which defines whether to add xml prolog or not )) and it works fine Thanks a alot for help )
 [2005-10-04 11:18 UTC] schst
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.