content type for XHTML fragments

A common use nowadays, especially with wikis and newsfeeds, is to store 
XHTML fragments (such as "this is <em>really</em> cool") to be later 
integrated into a larger XHTML document.

What content type should we use for XHTML fragments? My first thought is 
"application/xhtml+xml", but does that somehow requires that the 
information be a complete XHTML document?

The XHTML 1.0 specification at http://www.w3.org/TR/xhtml1/#strict 
declares that a "strictly conforming document" must have, among other 
things, a DOCTYPE and an <html> element. But the application/xhtml+xml 
specification at http://www.ietf.org/rfc/rfc3236.txt seems to indicate 
that "application/xhtml+xml" doesn't necessarily mean "XHTML 
document"---in fact, it says:

     With respect to XHTML Modularization [XHTMLMOD] and the existence
     of XHTML based languages (referred to as XHTML family members)
     that are not XHTML 1.0 conformant languages, it is possible that
     'application/xhtml+xml' may be used to describe some of these
     documents. ...

     Although conformant 'application/xhtml+xml' interpreters can
     expect that content received is well-formed XML (as defined in
     [XML]), it cannot be guaranteed that the content is valid XHTML
     (as defined in [XHTML1]).  This is in large part due to the
     reasons in the preceding paragraph. (section 2, pages 1-2)

This leads me to believe that we may be able to use 
"application/xhtml+xml" to mean "XHTML fragment", meaning that we 
wouldn't have to put the <html> tags in XHTML fragments specified as 
"application/xhtml+xml". But see this discussion:

http://www.intertwingly.net/wiki/pie/ContentProblems

Would we have to wrap fragments with at least a surrounding element? 
Must XHTML fragments validate as XML? It would be very useful if there 
was no such requirement---but what content type should we use to 
identify such XHTML fragments?

Garret

Received on Monday, 16 January 2006 07:28:27 UTC