88739

How to use RDFa “vocab” within XHTML

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:.)

</li> <li>

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.

Recommend

  • SPARQL - Unknown namespace prefix error
  • How to perform XML Validation when using ModelDriven?
  • Updating ASP.NET UpdatePanel during processing loop
  • PHP Session check not working when i redirect from another page
  • ModelAndView object not returned to jsp
  • Interceptor not getting called in Struts
  • Global results with Struts 2 and convention plugin
  • Setting up Subversion Server on Mac OS mountain lion (have access via browser, but un-able to checko
  • Xcode 4.6 automatic entitlement not working - “no valid aps-environment”
  • How to validate DTD against XML in Node.js
  • Login form issue with spring security 2.0.7 and spring 2.5
  • Dynamic Event Handler not Firing
  • a:first-child modifying all links within my list
  • How to forcefully download .csv file instead of getting in open on browser in html
  • Using target on div without a href
  • Is it possible to extract table infomation using Apache Tika?
  • Why is this button causing my layout to break?
  • Hibernate - Cannot connect to DB
  • What is the best way to include a style sheet for a specific page?
  • How do I include screenshots of the full page in my serenity report (and not only of the viewport) u
  • ng-repeat not working with table but works with list
  • JSF2.0 + Primefaces 3.0.1 + jquery 1.6.4 + p:commandLink + IE8 throws Unexpected call to method or p
  • How can I include If-None-Match header in HttpRequestMessage
  • Parse a date string in a specific locale (not timezone!)
  • JSON response opens as a file, but I can't access it with JavaScript
  • Bad request using file_get_contents for PUT request in PHP
  • Display issues when we change from one jquery mobile page to another in firefox
  • Accessing IRQ description array within a module and displaying action names
  • SSO with signing and signature validation doesn't work
  • Deserializing XML into class C#
  • Do I've to free mysql result after storing it?
  • How to get icons for entities from eclipse?
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • JTable with a ScrollPane misbehaving
  • unknown Exception android
  • JaxB to read class hierarchy
  • costura.fody for a dll that references another dll
  • failed to connect to specific WiFi in android programmatically
  • How can I use threading to 'tick' a timer to be accessed by other threads?