33

I am using few facebook social plugins and I am using the meta header. When validating the page, the W3C validator is throwing the error -> "Error: there is no attribute "property".

I am using the XHTML Transitional doctype - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Pls Suggest if I have to change the doctype to something else.

2

3 Answers 3

43

Facebook's plugins use Open Graph, which is built on RDFa. It's RDFa that adds the property attribute to elements. Without this addition, plain HTML has no such attribute. (If you ask me, it's a strange design to add a new attribute without namespacing it, and to re-use half of a <meta> tag. But no-one did.)

To validate XHTML-with-RDFa, you'll need the DOCTYPE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

This means you will have to be writing valid XHTML 1.1. More

6
  • 1
    You are a genius indeed! My full header now looks like this (sorry, no markup). <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-2.xsd" lang="de" xml:lang="de" dir="ltr" xmlns:og="http://ogp.me/ns#" > Mar 15, 2011 at 11:14
  • 15
    Ugh! Facebook must have had a very junior programming team! They openly state that "Developer simplicity is a key goal of the Open Graph protocol" adding a link to a slideshow (scribd.com/doc/30715288/…) in which it says that reusing the <link rel="canonical" ... is too complex ??? Too comlex!!! Reusing the normal name and title tags is probably also too complex? But mandating a specific XHTML+RDFa schema is developer simplicity? Oh well... Jul 31, 2011 at 21:15
  • @StefanHoth did you manage to validate with that code? When I run it through W3C's validator I get: Error: value of fixed attribute "version" not equal to default May 26, 2012 at 15:17
  • 1
    @StevenGarcia Yes. Checkout my website to see it in action validator.w3.org/… May 27, 2012 at 12:03
  • 1
    Your link to rdfa.org is dead, maybe the spec at w3c will suffice?
    – BryanH
    Oct 4, 2012 at 22:37
5

In order for a document to claim that it is a conforming HTML+RDFa document, it must provide the facilities described as mandatory in this section. The document conformance criteria are listed below, of which only a subset are mandatory:

  1. All document conformance requirements stated as mandatory in the HTML5 specification must be met.
  2. There should be a version attribute on the html element. The value of the version attribute should be HTML+RDFa 1.0 if the document is a non-XML mode document, or XHTML+RDFa 1.0 if the document is a XML mode document.
  3. There may be a link element contained in the head element that contains profile for the the rel attribute and http://www.w3.org/1999/xhtml/vocab for the href attribute.

Example:

<html version="HTML+RDFa 1.1" lang="en">
  <head>
    <title>Example Document</title>
  </head>
  <body>
    <p>Moved to <a href="http://example.org/">example.org</a>.</p>
  </body>
</html>
3

As Open Graph suggests, if you're using HTML5, you're better off just using a prefix attribute like this:

<!doctype html>
<html prefix="og: http://ogp.me/ns#">
  <head>
    <title>HTML5 site</title>
    <meta property="og:title" content="The Rock" />
  </head>
  <body>
  </body>
</html>

You can leave the doctype as is and it will validate.

This approach has also been recommended by an Open Graph developer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.