Re: XML_Functions

From: Date: Fri, 02 Apr 2004 08:57:43 +0000
Subject: Re: XML_Functions
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-26957@lists.php.net to get a copy of this message
> I suspect XML_FastCreate is a more suitable name. Ok it's a good name for me too. > - In addition to returning strings, It would nice if it could return > XML_Tree / HTML_Template_Flexy_Element / HTML_Common ... etc. elements > as well: > > ** you should define a standard create method and ask the authors to > implement this... > eg. XML_Tree::FastCreate($tagname,$attributes,$children); > Why not, but this make dependecies on my packages.. > eg. > $x = new XML_FastCreate(array( > 'class' => 'XML_Tree', > ) > $tree = > $x->xml( > $x->somecode( > $x->abc() > ), > $x->a( > array("href='fred'"), > 'some text' > ), > $x->p( > ' this is a paragraph' > ) > ); > > echo $tree->toXML(); > > It looks like a really clean way to create xml/html yes :) > (as for creating 'correct' XML/Xhtml etc... - using a validating backend > would solve this...) I will add a control with a DTD file if precised ( with the XML_DTD package ). > > Regards > Alan > > > Guillaume Lecanu wrote: >> Hi all, >> >> I have adapted the mod_cgi of perl for PEAR. >> >> Exemple of use in perl : >> a({ href=> 'example.org' }, >> span("Go to Example.org") >> ) >> >> This method make a valid XML contents. >> >> My problem was to prefix all functions tags with the name of the package >> or making an object for respect the PEAR standards. >> (cf. thread "Prefix function name problem") >> >> So, i have made an object, with an overload system ( thanks to Alan >> Knowles for this advice ). >> >> Example of use : >> >> $x->a( array(href=>'example.org'), >> $x->span("Go to Example.org") >> ) >> >> My code is alpha for now, i will add documentations and after i will >> propose this code on PEAR. >> >> For more details (sources/alpha tarball/tests) : >> http://lya.no-ip.com/pear/XML_Functions/ >> >> >> I have just one question, the overload system need to be declared like >> this : >> >> // Call the overload() function when appropriate >> if (function_exists("overload") && phpversion() < 5) { >> overload("XML_Functions"); >> } >> >> // Create the object instance >> $x = new XML_Functions(); >> >> I have put theses lines into the Functions.php file (with the class), is >> you think is a good way ? or is theses lines *must* always add by the >> developpers in each php files ? >> > > > -- > Can you help out? > Need Consulting Services or Know of a Job? > http://www.akbkhome.com > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

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