[Seaside] XHTML is a tree, not a stream

Lukas Renggli renggli at gmail.com
Wed Nov 8 13:38:08 UTC 2006

> > What you request was standard in earlier versions of Seaside. I am not
> > sure if the code is still there though, but you can easily add it
> > again by creating your own subclass of WAHtmlDocument.
> In fact, I don't need it. I was just wondering if it would be
> interesting. It seems you think it wouldn't.

Well, there are certainly different approaches to generate HTML. If I
am correct SimpleWeb is using an approach where composites of tags can
be copied, stored, rendered, etc. The other extreme are templates,
where you have just a single huge string.

> - it would be possible to modify a previously rendered
> node/tag (adding content or changing parameters)

I never felt the need to do that. Rendering is a read-only phase
anyway, so you should know you whole state upfront anyway.

> - #with: would not be necessarily at the end anymore
> (because the tag is really closed when the tree is
> converted to the stream)

The problem with the #with: could also be solved otherwise, such as by
caching the block and evaluating it when the tag is flushed. However I
find it quite a nice convention to have the #with: to be the last
element, even-though this looks more like a technical restriction to
some people.

> - Seaside would then have one representation of a
> document (a tree) that can be easily converted to multiple
> kind of output (XHTML, LaTeX, other XMLs...)

The Seaside renderer creates XHTML tags. Of course you could transform
this tree to LaTeX or other XMLs, however this is certainly not
feasible in all cases. After all you can also generate LaTeX by
subclassing WADocument and directly stream LaTeX instead of XHTML by
mapping XHTML tags to LaTeX tags, this is what we did for some
commercial project a long time ago.

> - there might be other advantages

Ok, tell me ;-)


Lukas Renggli

More information about the Seaside mailing list