Config Packages and XML Error, maybe a bug
| From: | angelo at odi dot com dot br | Date: | Tue, 15 Jul 2003 22:01:20 +0000 |
| Subject: | Config Packages and XML Error, maybe a bug | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6617@lists.php.net to get a copy of this message | ||
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?
Tks ,
Angelo