Re: RDFa in HTML vs XHTML

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 UTC