Re: XML_FastCreate (was: XML_Functions)
| From: | Alan Knowles | Date: | Sun, 04 Apr 2004 04:01:55 +0000 |
| Subject: | Re: XML_FastCreate (was: XML_Functions) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-27011@lists.php.net to get a copy of this message | ||
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.
));
* 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..).
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..
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;
...
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.
(BTW - never use TAB's in pear code.. - the 4 spaces is the indentation level increase)
Regards
Alan
||
|
|| 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,