[Seaside] valid xhtml and well formed xml

kustos kustos at gmx.net
Mon Nov 8 22:42:18 CET 2004


Hi

We are playing with seaside in the smalltalk lecture at the university. 
I noticed that it doesn't really produce 100% valid xhtml output at all 
times.
One thing is that for the script element, the type attribute is missing:
So in
WARenderedHtmlRoot>>writeStricpt:On:
I changed
aStream nextPutAll: '<script src="', url, '"></script>'.
to
aStream nextPutAll: '<script type="text/javascript" src="', url, 
'"></script>'.

This is kida hack, I'd suggest something like writeScript:Type:On: and 
writeStricpt:On class that with 'text/javascript' or so.

Then in
WAStoreInfo>>text
^
'Welcome to the sushiNet online store.
<p>
This is a sample Seaside application.
<p>
Use the search box at the top left to find some results.
Good searches to try might be "tuna", "saba", or "fish".
'

Obviously doesn't generate generate well formed xml because the p 
element is not closed.

so it should be:
text
^
'Welcome to the sushiNet online store.
<p>
This is a sample Seaside application.
</p>
Use the search box at the top left to find some results.
Good searches to try might be "tuna", "saba", or "fish".
'
Then for the html element, xmlns xml:lang and lang are missing.
I was told that I should in all my components override.
MyComponent>>updateRoot: anHtmlRoot
I don't want to do that so I added in
WAHtmlRoot>>initialize
the following
    htmlAttrs at: #xmlns put: #'http://www.w3.org/1999/xhtml'.
    htmlAttrs at: #xml:lang put: #en.
    htmlAttrs at: #lang put: #en.

And there is of course the problem that the content is not delivered as 
application/xhtml+xml. I don't develop professional webapplictions with 
seaside so I don't care about IE. And what is the point in delivering 
xhtml as html again? The browsers have to treat is as html, so where is 
the benefit?

So in
WAKom>>convertResponse: aResponse
I changed
  komResponse contentType: aResponse contentType.
to
  responseType := aResponse contentType.
  komResponse contentType:
      ((responseType beginsWith: 'text/html')
            ifTrue: ['application/xhtml+xml; charset=utf-8']
            ifFalse: [responseType]).

I know this is a hack, but at least now I have my xhtml parsed as xml as 
it is meant to be. :-)
You can now even check automatically if you produce well formed xml 
because your browser will refuse to display it if it's not (at least 
mozilla does). This is how I found the WAStoreInfo>>text problem.

Additionally there are problems with:
"page expired" has no doctype
in "page expired" the meta element is not closed
And "profile" is not well formed because of the  character

Greets
Philippe Marschall


More information about the Seaside mailing list