PEAR::Config and XML container
| From: | Laurent Laville | Date: | Fri, 10 Mar 2006 16:20:56 +0000 |
| Subject: | PEAR::Config and XML container | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-23265@lists.php.net to get a copy of this message | ||
Is this simple xml file suppose to be well formed or not ?
test.xml contents is only between * lines
**********************************************************
1. *<?xml version="1.0" encoding="UTF-8"?>
2. *<!--
3. * a simple comment4. * --> *********************************************************** if answer is : its well formed then i have problem to parse it with PEAR::Config 1.10.6 and xml container here is my script test : <?php require_once 'Config.php'; $conf = new Config(); $root =& $conf->parseConfig('test.xml', 'xml'); if (PEAR::isError($root)) {
die ( $root->getMessage() );} $arr = $root->toArray(); echo '<pre>'; var_dump($arr); echo '</pre>'; ?> output: XML_Parser: no element found at XML input line 4:5 BTW, i also want to know if it's possible to parse boolean content Here is my other xml test file *********************************************************** 1. *<?xml version="1.0" encoding="UTF-8"?> 2. *<!--
3. * pfm web frontend preferences4. * --> 5. *<conf> 6. * <simpleoutput /> 7. * <simpleoutput2>true</simpleoutput2> 8. * <simpleoutput3>false</simpleoutput3> 9. *</conf> *********************************************************** and here are output : array(1) { ["root"]=> array(1) {
["conf"]=>
array(3) {
["simpleoutput"]=>
string(0) ""
["simpleoutput2"]=>
string(4) "true"
["simpleoutput3"]=>
string(5) "false"
}
}
}
Feedback will be greatly appreciated
Laurent