Is cloaking RDF cheating?

Despite the fact that I think they’re both joking, I presume that other people will think that using PHP and user-agent sniffing to hide TrackBack RDF from validators is cheating, or wrong, or that the page with RDF in it remains in some meaningful sense invalid. I don’t think so. While it’s true that a page of XHTML and RDF intermingled is not a Strictly Conforming XHTML document, it is still exactly what the W3C says you should do. Whether you do it now, shielding the validator’s eyes from things it can’t understand, or wait depends on how patient you are.

In February 1999, in the RDF Recommendation, the W3C stated its official position as:

The recommended technique for embedding RDF expressions in an HTML document is simply to insert the RDF in-line as shown in Example 7.7. This will make the resulting document non-conformant to HTML specifications up to and including HTML 4.0 but the W3C expects that the HTML specification will evolve to support this.

In January 2000, in the XHTML Recommendation, the W3C stated its official position as

The XHTML namespace may be used with other XML namespaces as per [XMLNAMES], although such documents are not strictly conforming XHTML 1.0 documents as defined above. Future work by W3C will address ways to specify conformance for documents involving multiple namespaces.

In August 2002, in the second edition of the XHTML Recommendation, they amended the last sentence to read:

Work by W3C is addressing ways to specify conformance for documents involving multiple namespaces. For an example, see [XHTML+MathML].

It’s not quite clear how XHTML 2.0 will address other namespaces, since the August 2002 Working Draft doesn’t seem to say anything about it at all. However, given that one of the goals is to ensure that XHTML 2.0 can be readily supported by XML browsers that have no arcane knowledge of XHTML semantics, it seems quite likely that the problem of mixing namespaces will be solved by then. If you plan to wait for it to become a Recommendation, well, that’s slated for sometime after July 2004.

In the meantime, my pages will have an XHTML portion which is valid XHTML, an RDF portion which is valid RDF, both accessible to XML parsers, and the big two (X)HTML validators will be spared the trouble of looking at things they haven’t yet been told how to handle. Now if I could just convince Dori that it’s the right thing to do, WaSP or not.


Comment by Marcus #
2002-08-26 01:01:05

I’m not sure it changes anything per the validator in this case, but developers have to be careful of what content-type your data is sent as.

Time for a wee lecture for anyone interested:

Most people with XHTML pages (myself included) pass their pages as text/html, so browsers (well, I know Mozilla does…) end up using the HTML parser to display them.

A squeelion bugs are filed (to Mozilla) when people try to add XML extensions to their XHTML and wonder why it isn’t working right. Generally comes down to this. If you want to use XHTML as XML then you have to send it as text/xml or application/xhtml+xml. Then the browser will use its XML parser, and everything will work as expected. Plus, it’ll give the strictest and most immediate validation you can get. If it’s wrong, it just won’t work.

Easiest way to do this is by renaming any XHTML files *.xml, or if you’re using PHP (again, like I am) you’ll have to fiddle with the header() function.

Comment by Phil Ringnalda #
2002-08-26 07:46:34

I can’t find any mention of it in my posts, but as I remember I tried that while mucking around with the DTD, and I’m pretty sure it neatly solves the validation problem because the validator says ”Sorry, I don’t know how to deal with any content type except text/html.”

Name (required)
E-mail (required - never shown publicly)
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <del datetime="" cite=""> <dd> <dl> <dt> <em> <i> <ins datetime="" cite=""> <kbd> <li> <ol> <p> <pre> <q cite=""> <samp> <strong> <sub> <sup> <ul> in your comment.