Re: PEAR::Config, PHP5 and XML problems
| From: | Bertrand Mansion | Date: | Thu, 26 Feb 2004 09:11:52 +0000 |
| Subject: | Re: PEAR::Config, PHP5 and XML problems | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10951@lists.php.net to get a copy of this message | ||
<lance@monkeymental.com> wrote :
> I'm having a problem with Config, PHP5 and XML files. Everything works
> fine with PHP 4.3.4 but it doesn't work with PHP5.
>
> parseConfig generates errors relating the the various handlers
> (startHandler, cdataHandler, endHandler). Since these handlers are just
> stub functions (return NULL;) in the XML_Parser class and are actally
> implemented in the Config/Container/XML.php config.
>
> The samle code, XML file, and outputs are below. I could really use some
> help on this, or another solution to parse my XML config files.
>
> Regards,
> Lance O'Connor
> lance@monkeymental.com
>
>
> Sample Code:
> <?
> require_once('Config.php');
>
> $Config = new Config();
> $root =& $Config->parseConfig('./graphics.xml', 'xml');
> print_r($root);
> ?>
>
> XML File:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <switch>
> <row>
> <port type="RJ">FastEthernet0/1</port>
> </row>
> </switch>
>
>
> PHP 4.3.4 Output:
> PHP 4.3.4 (cli) (built: Jan 16 2004 21:49:20)
> Copyright (c) 1997-2003 The PHP Group
> Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
> config_container Object
> (
> [type] => section
> [name] => root
> [content] =>
> [children] => Array
> (
> [0] => config_container Object
> (
> [type] => section
> [name] => switch
> [content] =>
> [children] => Array
> <snip> [_id] => switchsection403d8ed8101a30.86454393
> )
>
> )
>
> [parent] =>
> [attributes] =>
> [_id] => rootsection403d8ed80d8a90.51860680
> )
I am not surprised that Config does not work with PHP5. It will probably
need a complete rewrite as PHP5 adds new features needed by Config and I had
to find workarounds for them in PHP4.
The Config package will benefit a lot from the new PHP5 features, especially
the xml parser (will use simpleXML probably).
Unfortunately, I don't have the time to fix it now. Personally, I don't have
PHP5 installed yet. So you will have to find another way to parse your XML.
Bertrand Mansion
Mamasam