Re: [RfC] XML_Serializer

From: Date: Wed, 30 Jul 2003 19:51:14 +0000
Subject: Re: [RfC] XML_Serializer
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18974@lists.php.net to get a copy of this message
<schst@php-tools.net> wrote : > Hi, > >> The Config package can already convert a PHP array to XML and >> back. Could you please summarize for me what new features >> your package brings. > Advantages of XML_Serializer: > - it's easier to use. Just call one method and hand over the structure > to serialize. Why should I have to use something generic like Config, > when I want to create an RDF document from an array? Config is also easy to use: $array = array('nodes' => array('node1' => 10, 'node2' => 20)); $conf = new Config(); $root =& $conf->parseConfig($array, 'phparray'); echo $root->toString('xml'); > - it's able to serialize an object. > - it's able to add type hints that can be used to unserialize, afaik all > config values are strings when using PEAR::Config > - it's generating valid XML, as it replaces &, ", <, > and '. When > using > these chars with Config, they will not be replaced by entities and thus > the config file can't be read again... Because of this problem I > suggested to release XML_Util (or maybe called XML) which supplies > methods to generate valid XML... This will be fixed in the next release. > - it's possible to change/switch off indentation That's probably easy to add to Config as it already handles indentation. > Basically it's more flexible and has a simpler API, as it's only used to > generate XML and not various filetypes. I get the idea. >> It might be worth having a look at >> Config and let me know what you think, and if Config could >> use your serializer in the future... > You could definitely use XML (or XML_Util) and maybe also XML_Serializer > in future versions of Config. > > So I hope I get your +1 for XML_Serializer and XML (or XML_Util) and > also a vote for one of the possible names for the XML package. You get my +1, my preference would go for XML_Common instead of XML or XML_Util, just like it is with HTML_Common. Bertrand Mansion Mamasam

« previous php.pear.dev (#18974) next »