PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Configuration » Config » Bug #1503

XML parsing fail on complex element

Details

Submitted2004-05-26 07:30 UTC
Frompnagy at allianz dot hu
Assignedmansion
StatusWont fix
PackageConfig
PHP Version4.3.5
OSWinXP Prof.
Roadmaps(Not assigned)

Comments

[2004-05-26 07:30 UTC] pnagy at allianz dot hu

Description:
------------
I'm using Config 1.10. In an XML-file containing complex-type elements the parser fail to create it right. The source xml looks like this:
-------------
<lit>You can write some text here which will displayed in <strong>full width</strong>on the form. Text could contain fields <field name="bar" src="post" />, they will displayed as pure text.
</lit>
-------------
The error shows in all output, so I think it is in the parser method.

Reproduce code:
---------------
<?php

require_once('Config.php');
// Config object
$config = new Config();
$root =& $config->parseConfig('flowConfExample.xml', 'xml');
echo $root->toString('phparray', array('name' => 'conf'));
require_once('Config/Container.php');
$out = $config->writeConfig ( 'output.ini', 'inifile', array('name' => 'conf') );
$out = $config->writeConfig ( 'output.apache.conf', 'apache', array('name' => 'conf') );
$out = $config->writeConfig ( 'output.generic.conf', 'genericconf', array('name' => 'conf') );
$out = $config->writeConfig ( 'output.xml.conf', 'xml', array('name' => 'conf') );
?>

Expected result:
----------------
$conf['flow']['page'][0]['section']['lit']['#'] = 'You can write some text here which will displayed in ';
$conf['flow']['page'][0]['section']['lit']['#']['strong'] = 'full width';
$conf['flow']['page'][0]['section']['lit']['#'] = 'on the form. Text could contain fields';
$conf['flow']['page'][0]['section']['lit']['field']['@']['name'] = 'bar';
$conf['flow']['page'][0]['section']['lit']['field']['@']['src'] = 'post';
$conf['flow']['page'][0]['section']['lit']['#'] = ', they will displayed as pure text.';

Actual result:
--------------
$conf['flow']['page'][0]['section']['lit']['strong'] = 'You can write some text here which will displayed in full width';
$conf['flow']['page'][0]['section']['lit']['field']['#'] = 'on the form. Text could contain fields';
$conf['flow']['page'][0]['section']['lit']['field']['@']['name'] = 'bar';
$conf['flow']['page'][0]['section']['lit']['field']['@']['src'] = 'post';

[2004-06-04 10:04 UTC] bmansion at mamasam dot com

This does not look like a configuration. Config's purpose is to parse/edit/write configuration files. Configuration files are usually more simple than what you propose here.

I suggest you rewrite your configuration by using htmlentities for < (<) and > (>) in your <lit> directive because it is what it is in the end.