not XML, but XHTML

2007-11-16 @ 17:47#

i've seen this come up several times recently and it's starting to appeal to me.

instead of pushing POX (plain old XML) around, use XHTML instead. the advantage is that rendering it is almost trivial for browser types. plus, there is enough 'semantic' info in the document (the HTML tags themselves along with any class or rel attributes) that it's meaning can be easily derived in most cases. finally, there is enough work out there to leverage enriching the XHTML including microformats and dublin core along with others.

the downside, IMHO, is that validating inputs is harder (i use XSD right now - easy to put together against POX), the size of the document will grow (now it needs to be a valid XHTML doc, right?) and there will be some additional work pulling the data from the doc in order to place into a database (i use XSLT for that now - again rather trivial against POX).

but i guess the beset argument in favor of XHTML is hyperlinking. this is the part of the REST arch documents that i really fail at right now. if i send XHTML around, standard browsers will be able to not only render the view, but also render the links to other related items.

i wonder if this doesn't complicate the 'view' aspect of app building. i like the idea of publishing a clean XML layer for data-handling and *then* adding a layer of rendering templates against the data XML. i've got to think on this some more, but i can see where it makes sense.

code