
Question:
I'm trying to get this (simple) webpage done for my assignment and it needs to pass through <a href="http://validator.w3.org/" rel="nofollow">http://validator.w3.org/</a><br />
It also needs to use RDFa. However no matter what I do, the RDFa vocab
never gets passed by the validator.
Here's what I got:
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML+RDFa 1.0//EN' 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd'>
<body vocab="http://xmlns.com/foaf/0.1/">
What am I doing wrong?
Answer1:The vocab
attribute is defined in RDFa 1.1, but with your current DOCTYPE, you are using RDFa 1.0.
Your options:
<ul><li>Keep using XHTML 1.1 and RDFa 1.0, and use the xmlns:…
attribute(s) instead of the invalid vocab
attribute:
<body xmlns:foaf="http://xmlns.com/foaf/0.1/">
(Then you have to use the prefix foaf:
.)
Keep using XHTML 1.1, but <a href="https://stackoverflow.com/a/19974898/1591669" rel="nofollow">switch</a> to a DOCTYPE that supports RDFa 1.1:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
</li>
<li>Switch to XHTML5, which supports RDFa 1.1 by default:
<!DOCTYPE html>
</li>
</ul>Answer2:Do you really have to use XHTML? I would recommend to use an HTML5 doctype. <a href="http://www.w3.org/TR/html-rdfa/" rel="nofollow">http://www.w3.org/TR/html-rdfa/</a> has some examples.
Also, make sure you use the NU validator from W3C: <a href="https://validator.w3.org/nu/" rel="nofollow">https://validator.w3.org/nu/</a> - the one you are using is old and should no longer be used.