W3C home > Mailing lists > Public > public-html-data-tf@w3.org > November 2011

Re: RDFa in HTML vs XHTML

From: Toby Inkster <tai@g5n.co.uk>
Date: Sat, 12 Nov 2011 00:58:28 +0000
To: Gregg Kellogg <gregg@kellogg-assoc.com>
Cc: Jeni Tennison <jeni@jenitennison.com>, Ivan Herman <ivan@w3.org>, HTML Data Task Force WG <public-html-data-tf@w3.org>
Message-ID: <20111112005828.21017256@miranda.g5n.co.uk>
On Fri, 11 Nov 2011 16:38:23 -0500
Gregg Kellogg <gregg@kellogg-assoc.com> wrote:

> <div about="">
>   <p property="rdf:value" typeof="">A paragraph.
>   <p property="rdf:value" typeof="">Another paragraph.
> </div>
> 
> Because the paragraphs aren't closed, it would be possible if parsing
> as a SAX document that different RDF would be generated. This might
> be:
> 
> <> rdf:value [ rdf:value []].
> 
> where the intent was
> 
> <> rdf:value [], [] .

An HTML processor will generate the latter. A conformant XML processor
should simply throw a well-formedness exception.

A better example, which, although invalid, should be accepted but
interpreted differently under HTML and XML parsers is:

	<div about="">
	  <table about="#me">
	    <p property="dc:title">Hello World</p>
	  </table>
	</div>

An HTML parser will lift the <p> element out of the table and place it
as a child of the <div> (IIRC it will be inserted prior to the <table>)
because <p> is not an allowed child of <table>.

So in HTML+RDFa will get:

	<> dc:title "Hello World" .
	# and no triples about <#me>

And in XHTML+RDFa:

	<#me> dc:title "Hello World" .
	# and no triples about <>

Yay, fun. :-)

What other fun ones can I think of...?

	<html about="#foo">
	  <h1 property="dc:title">Hello World</h1>
	  <p property="dc:description">A global greeting for all.</p>
	</html>

Anyone want to guess the subject URI for the two triples when processed
as HTML? Hint: it ain't <#foo>.

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>
Received on Saturday, 12 November 2011 00:57:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 12 November 2011 00:57:58 GMT