From: ara.t.howard@... Date: 2006-01-25T11:03:11+09:00 Subject: Re: [ANN] xx-0.1.0 : xhtml and xml make it twice as dirty On Wed, 25 Jan 2006, James Britt wrote: > mental@rydia.net wrote: >> Quoting "Ara.T.Howard" : >> >> >>> doc = xhtml_{ >>> html_{ >>> head_{ title_{ " go xx! " } } >>> body_{ " one more and it would be illegal " } >>> } >>> } >> >> >> Out of curiousity, how does this compare with markaby? > > Or the XML Builder in Nitro, which has a similar syntax? hmm. i think the implimentation is better ;-) seriously - i have a big problem with blanket method_missing like those used in the nitro and rails xml builders - they make debugging an absolute nightmare that reminds me of perl. by using a simple rule : tag methods end in underscore, i can delegate to the default method missing in cases where a mere typo was made. eg. in nitro foo will output but not in xx. you have to be explicit that you need to generate a tag using foo_{ 42 } which will generate 42 also, the return value of blocks do not appear to be used very well in nitro (i could be wrong here). my reading of the docs seems to suggest that foo{ 42 } would output simply in xx this outputs 42 as you would expect. again, alot of this revolves around handling method_missing in a catch-all fashion. because the handling is so generic in nitro's xml builder it is un-suitable to mixin to your own classes, let alone built-in ones. with 'xx' this is not so - the library is quite carefully designed to pollute the includee (is that a word?) namespace minimally and certainly will not hide errors or, worse, simply output xml/xhtml when a typo is made. this is all possible due to the requirement that tag methods end in underscore. xx handles both xml, xhtml, and xhtml. for all of them you will be hard pressed to generate invalid documents - generating end tags is not supported because it is always done for you in a sensible way. lastly - 'xx' generates xhtml in a way that should be friendly to IE - something which is harder than it ought to be. i can thank sean (rexml) for that! cheers. -a -- sleep is the best meditation. -- h.h. the 14th dali lama