PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » XML » XML_Parser » Bug #5557

XML_Parser: Unable to create XML parser resource.

Details

Request #5557XML_Parser: Unable to create XML parser resource.
Submitted2005-09-29 11:36 UTC
Fromvit at vit dot pp dot ru
Assignedschst
StatusClosed
PackageXML_Parser
PHP Version4.3.10
OSWin xp sp2
Roadmaps(Not assigned)

Comments

[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.

[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: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: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 )