Re: XML_FastCreate (was: XML_Functions)

From: Date: Sun, 04 Apr 2004 09:49:39 +0000
Subject: Re: XML_FastCreate (was: XML_Functions)
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-27012@lists.php.net to get a copy of this message
Hi, Le dim 04/04/2004 à 04:01, Alan Knowles a écrit : > I would suggest the following: > > a) constructor: > rather than > |$x = new XML_FastCreate('xhtml1-strict.dtd', 3); > use: > |$x = new XML_FastCreate(array( > 'output' => 'XML_Tree', // default > 'errors' => XML_FASTCREATE_RETURN, // is this what the '3' > is? > 'dtd' => dirname(__FILE__).'/xmlhtml1-strict.dtd' // full > path to dtd. > )); I will do that, but i think the default output must be 'text' for dependencies reasons. If a developper don't want the DTD control, he have just to write : $x = new XML_FastCreate; And i think the text method should be a little more rapid than 'XML_Tree'. After, if the developper want to convert data to XML_Tree, he writes : $tree = $x->textToTree($text) (was $x->stringToTree) What do you think about this default mode ? > > * this has a number of benefits: > - if someone sees some code that is using XML_FastCreate (and have > never seen it before) They have a good chance of understanding the > intention of the code in front of them. > - its a bit easier to add features in the future (without bloating the > api too much..). i agree, it's a good idea. > > b) remove |support for > $x->useTree(); > > in a large bit of code - it would encourage the writer to flip generator > techniques - ending up with the problem that they may accidentilly be in > the wrong mode.. Ok, and if the developper need to convert data, he could be use the textToTree()/treeToText() methods. > > it's far clearer if the have seperate instances for each geneator type > > $fc_text = new XML_FastCreate(array('output'=>'text')); > ||$fc_tree = new XML_FastCreate; This way is not very usefull, but possible. The best way is to add the constructor line into a included file of each XHTML pages. And when the developpement is finish, remove the DTD control for don't uses packages dependencies (except if you use the 'XML_Tree' mode) and accelerate the page rendering. > > ... > > > create a account on pear.php.net - and use pepr to propose it. - After > you've filled in the source phps. links - I'm sure someone will probably > look through and check the CS for you. Ok > > (BTW - never use TAB's in pear code.. - the 4 spaces is the indentation > level increase) Ok, i'm going to change that. > > Regards > Alan Again a time, thanks for your advices :) > > || > > > | > > > > | > | > > Guillaume Lecanu wrote: > > >Hi all, > > > >I have finish my XML_FastCreate class, > >i have to clean the code and add comments. > > > >For resuming, this package do : > >- an easy way for making XML data ( principaly for making XHTML page ) > >- a control with the DTD for prevents validation problem ( like if you > >checked your page with the W3C validator ) > >- possibility to use strings or XML_Tree for representing elements > > > >I have made 4 examples to see it in action : > >http://lya.no-ip.com/pear/XML_FastCreate/tests/ > > > > > >It's my first package, so i have a little question about coding > >standards : > > > >- On the coding standard page i see the tabulation must be 4 characters: > >http://pear.php.net/manual/en/standards.php > >But on the page > >http://pear.php.net/manual/en/faq.tabs-vs-spaces.php i > >see the tabulation must be replaced by spaces. > > > >My package could be use XML_DTD and XML_Tree, but theses 2 packages have > >2/3 bugs, i have make a bug report and i have sent patchs. > >Now, i will forced to wait the maintainers before sending my package. > > > >Thanks > >Best regards, > > > > > >

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