Re: Config Packages and XML Error, maybe a bug

From: Date: Tue, 15 Jul 2003 22:39:05 +0000
Subject: Re: Config Packages and XML Error, maybe a bug
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-6619@lists.php.net to get a copy of this message
<angelo@odi.com.br> wrote : > Hello All, > > This is my first post to the list, nice to be here :) > > > I'm creating a config file for a small aplications using Config Package from > pear. > > I'm able to create the config file, but whem i var_dump() the result from > parseConfig() i get > > object(xml_parser_error)(8) { > ["error_message_prefix"]=> > string(12) "XML_Parser: " > ["mode"]=> > int(1) > ["level"]=> > int(1024) > ["code"]=> > int(17) > ["message"]=> > string(78) "xml processing instruction not at start of external entity at XML > input line 2" > ["userinfo"]=> > NULL > ["backtrace"]=> > NULL > ["callback"]=> > NULL > } > > > The config.xml file > > <?xml version="1.0" encoding="ISO-8859-1"?> > <?xml version="1.0" encoding="ISO-8859-1"?> > <DATABASE> > <DSN>pgsql://user:pass@localhost/betoplotagem_com_br</DSN> > </DATABASE> > <WWWPASTAS> > <WWWWROOT>http://plot.odi.com.br/cliente</WWWWROOT> > </WWWPASTAS> > <PASTAS> > <DIRROOT>/home/www/html/plot.odi.com.br/cliente/</DIRROOT> > <DIRINC>/home/www/html/plot.odi.com.br/cliente/template/</DIRINC> > <DIRLIB>/home/www/html/plot.odi.com.br/cliente/classes/</DIRLIB> > </PASTAS> > <SUPORTE> > <email>suporte@odi.com.br</email> > </SUPORTE> > <INCLUDES> > <a0>DB.php</a0> > <a1>/home/www/html/plot.odi.com.br/cliente/classes/cls_object.php</a1> > </INCLUDES> > > > > The code used to create the file: > > $obj_container =& new Config_Container('section', 'conf'); > > $section = &$obj_container->createSection('DATABASE'); > $section->createDirective('DSN', $DBTYPE . "://" . $DBUSER . > ':' . $DBPASS . > '@' . $DBHOST . '/' . $DBNAME); > > $section = &$obj_container->createSection('WWWPASTAS'); > $section->createDirective('WWWWROOT',$WWWROOT); > > $section = &$obj_container->createSection('PASTAS'); > $section->createDirective('DIRROOT',$DIRROOT); > $section->createDirective('DIRINC',$DIRINC); > $section->createDirective('DIRLIB',$DIRLIB); > > $section = &$obj_container->createSection('SUPORTE'); > $section->createDirective('email',"suporte@odi.com.br"); > > $section = &$obj_container->createSection('INCLUDES'); > $section->createDirective('0',"DB.php"); > $section->createDirective('0',$DIRLIB . 'cls_object.php'); > > > // set this container as our root container child in Config > $config = new Config(); > $config->setRoot($obj_container); > // write the container to a php array > $config->writeConfig('config.xml', 'xml'); > // print the content of our conf section to screen > > The code to parse > > $config = new Config(); > $root > =&$config->parseConfig('/home/www/html/plot.odi.com.br/cliente/config.xml', > 'xml'); > var_dump($root); > > > In the begin of the config.xml file it shows <?xml version="1.0" > encoding="ISO-8859-1"?>, that does not look right. > > I'm kida lost. Does anyone have a sugestion? Jon, Angelo, Funny, it looks like you both found a bug at the same time. I was able to reproduce it, it's probably located in the XML.php file. I can't fix it now because I need to sleep but as Angelo, you are in Brasil, you might find the time to fix it and send me a patch. Otherwise, I'll fix that tomorrow and probably add some new methods at the same time before the next release. BTW, it's prefarable not to use var_dump() on Config objects as Containers keep references of their parents so you might end up with huge outputs... Good night, Bertrand Mansion Mamasam

« previous php.pear.general (#6619) next »