Re: [PEPr] Comment on XML::XML_FastCreate

From: Date: Mon, 19 Apr 2004 14:14:23 +0000
Subject: Re: [PEPr] Comment on XML::XML_FastCreate
References: 1 2 3 4 5 6  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-28029@lists.php.net to get a copy of this message
Le lun 19/04/2004 à 15:46, Sergio Carvalho a écrit : > Guillaume Lecanu wrote: > > >Le lun 19/04/2004 à 13:17, Sérgio Carvalho a écrit : > > > > > >>Alan Knowles wrote: > >> > >> > >>>the closing /> can sometimes break html - I cant remember the example > >>>of hand, but it does cause havoc sometimes.. > >>> > >>> > >>I know of two cases: 1. <script /> causes IE to consider everything from > >>there on as script code. 2. <textarea /> causes both IE and Mozilla to > >>consider everything from then on as the textarea initial value. > >> > >> > > > >So, this is not a big problem because for theses 2 cases, a value is > >give to the method : > >$x->script('the script') => <script>the script</script> > >and not : > >$x->script() => </script> > > > >But i will remove the slash of single tag in "html" mode ( <br /> to > ><br>) > > > > > Nope, Gillaume. You can have a script tag with attributes only: > <script src="somewhere" type="text/javascript" /> > And you can perfectly have a textarea tag with an empty string. Yes but if i add an 'html' option for removing this slash, the problem is fixed ? > I think you are mixing two different problems, and digging a hole for > yourself in the process. Generating XML is really straightforward. Just > read the spec[1] (10 minutes) and you can write a valid XML generator in > under a day. Generating valid XHTML, dealing with all browser quirks is > a much more lengthy job -- with a lot of added value. The problem is on somes XML interpreters (not only (X)HTML domain), a <tag /> is different of <tag></tag>, but in XML specs, <tag></tag> equal <tag /> .. ( ex: Mozilla & IE makes 2 newlines with <br></br> ) Theses interpreters have non fixed bugs, and we can bypass bugs by using the valid single tag equivalent (<tag />). So, the best way is to use single tag, but with an option 'expand' to force all single tag (<tag />) to empty tag (<tag></tag>) And for HTML output, the expand option must be set to true. > > If I were in your shoes, I'd strip down XML_FastCreate's job to produce > only XML. Then, build on top of it something like HTML_FastCreate, with > a similar API, that knows how to handle browser quirks. You can have a > slew of other packages, for other XML Schemas (XSLT_FastCreate, > DocBook_FastCreate, whatever...) All XML tags are possible, so if people want to make HTML / DocBook or XSLT output, the PHP source not change :) > > References: > 1. http://www.w3.org/TR/2004/REC-xml-20040204/ Thanks, Regards, > > > >Thanks, > >Regards, > > > > > > > > > >>Sérgio Carvalho > >> > > > > > > > > >

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