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

Bug #18357 XML container generates invalid XML
Submitted: 2011-03-11 01:29 UTC
From: cweiske Assigned:
Status: Open Package: Config (version 1.10.12)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2011-03-11 01:29 UTC] cweiske (Christian Weiske)
Description: ------------ The XML container does not generate a root element by itself, so adding several directives to the root container results in having several XML elements on the top level. Test script: --------------- <?php require_once 'Config.php'; $conf = new Config(); $root = $conf->getRoot(); $root->createComment('Demo config file with XML container'); //we need a main section, otherwise we get invalid XML $main = $root->createSection('config'); $main->createDirective('openLastFile', true); $main->createDirective('rememberFiles', 8); $conf->writeConfig( 'xml-write.txt', 'xml', array( 'encoding' => 'UTF-8', 'indent' => ' ', ) ); Expected result: ---------------- <?xml version="1.0" encoding="UTF-8"?> <!-- Demo config file with XML container --> <config> <openLastFile>1</openLastFile> <rememberFiles>8</rememberFiles> </config> Actual result: -------------- <?xml version="1.0" encoding="UTF-8"?> <!-- Demo config file with XML container --> <openLastFile>1</openLastFile> <rememberFiles>8</rememberFiles>

Comments