How to use RDFa "vocab" within XHTML - xhtml

I'm trying to get this (simple) webpage done for my assignment and it needs to pass through http://validator.w3.org/
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?

The vocab attribute is defined in RDFa 1.1, but with your current DOCTYPE, you are using RDFa 1.0.
Your options:
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 switch 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">
Switch to XHTML5, which supports RDFa 1.1 by default:
<!DOCTYPE html>

Do you really have to use XHTML? I would recommend to use an HTML5 doctype. http://www.w3.org/TR/html-rdfa/ has some examples.
Also, make sure you use the NU validator from W3C: https://validator.w3.org/nu/ - the one you are using is old and should no longer be used.

Related

XHTML transitional self closing tags

I am using the
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Doctype and notice that I'm being suggested elements such as
<P /> instead of <p> </p>
In my eclipse IDE. Is this just a self closing tag? is the capital letter a standard of somesort?
Yes, <p /> is a self-closing tag for <p></p>, and is valid in XHTML (but not HTML5).
Every browser that supports XHTML supports the self-closing syntax for every tag:
Elements that are declared in the DTD as EMPTY can have an end tag or can use empty element shorthand (see Empty Elements).
Having said that, a self-closing paragraph makes no sense.
It's important to note that XHTML elements must be written in lower-case:
XHTML documents must use lower case for all HTML element and attribute names. This difference is necessary because XML is case-sensitive e.g. <li> and <LI> are different tags.
It's also important to note that the XHTML doctype is outdated as of 2012. I strongly suggest switching to HTML 5 instead.
Hope this helps! :)

What is minimal XHTML? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a question, basically I need to write the code for a table with minimal XHTML and CSS. I'm not quite sure what minimal XHTML is but my guess is that it's just showing the initial XML code without the doc type etc. That's what a site says.
But then all the examples of minimal XHTML contain the strict, transitional and frameset document types which is confusing me because wouldn't that just make it a normal XML page then?
Minimal XHTML is what is at least required as w3c recomendations, to be included in such type of document.
You can find details here w3c
I quote the most relevant of it...
The root element of the document must be html.
The root element of the document must contain an xmlns declaration for the XHTML namespace [XMLNS]. The namespace for XHTML is defined to
be http://www.w3.org/1999/xhtml. An example root element might look
like:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
There must be a DOCTYPE declaration in the document prior to the root element. The public identifier included in the DOCTYPE
declaration must reference one of the three DTDs found in DTDs using
the respective Formal Public Identifier. The system identifier may be
changed to reflect local system conventions.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
The DTD subset must not be used to override any parameter entities in the DTD.
The question being: "(a)Illustrate using minimal XHTML and CSS how you would layout a data table like the following..." then it shows a table.
As a teacher—and if that's all you have to go on—I would read that as: "Show the basic HTML and CSS needed to construct this table, without adding unnecessary details." Presumably the examiner doesn't want to trawl through a lot of fancy code that shows off your skills but that isn't really needed to demonstrate you know how to code a table appropriately.
In principle, the most logical interpretation of “minimal” is “using the smallest amount of characters”. Probably line breaks are not counted, however; omitting them would make the code essentially less convenient to read. The problem still isn’t well-defined, since it does not define what XHTML version(s) may be used.
If XHTML linearization (syntax) for HTML5, known as XHTML5, is allowed, then the minimal XHTML document containing a table and reference to a style sheet is the following (when line breaks are not counted:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title></title>
<link rel="stylesheet" href="a.css"/></head>
<body>
<table><tr><td></td></tr></table>
</body>
</html>
Techically the style sheet URL could be shorter, but it’s not reasonable to use a URL that does not end with .css.
Other XTHML versions have different rules, resulting in a somewhat longer minimal document, due to the length of the doctype declaration.

IE8 displaying page incorrectly

For one reason or the other IE8 is not displaying my webpage properly. It works on every other major browser but everything is helter-skelter when I try to open the page on IE8 and since majority of the users of this page primarily use IE8, I cannot ignore it. Here's the link to it: http://www.gradschool.purdue.edu/gradexpo/mailinglist/
You haven't set a doctype. Put this at the very top of your page:
<!DOCTYPE html>
IE put itself into 'quirks' or Compatibility mode when it doesn't see a doctype, which will mess up your layout. Specifying a doctype will kick it into Standards mode which will remedy most problems. IE is still pretty useless at rendering CSS properly, so you might still have some issues.
Note you could also use the HTML 4.01 Strict doctype, but this will give the same result:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
get a doctype at the top of your html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
then run it through http://validator.w3.org
and fix other errors
In addition to the critical error of a missing doctype as others have pointed out, you have a few serious HTML errors.
W3C Validation
You have repeated your closing tags for </body> and </html>. You also have a couple unused closing div tags, </div>. All of the meta tags in your <body> need to be moved to within the <head> section. Browsers will handle these kinds of errors with unpredictable rendering.

"Converting" XHTML 1.0 Strict to HTML5

OK folks,
So I have a valid XHTML 1.0 Strict webpage. I'm aware of the differences between XHTML and HTML, but, what are the differences between XHTML and HTML 5?
Would a 'conversion' be as easy as changing the Doctype, and it would all still validate OK?
Or, are there markup differences that would need to be changed first?
Thanks!
Jack
To summarize this post and this post...
All you need to do to start taking advantage of the benefits of HTML5 is to convert your doctype from XHTML to HTML5. HTML5 is compatible with XHTML.
If you want to introduce new HTML5 tags, you will also want to add a polyfill like Modernizr so that Internet Explorer can figure out how to render the new HTML5 elements.

Full Example XHTML document showing how to define additional attributes

I am trying to extend an xhtml document to allow extra attributes.
In the w3.org it gives an example like so:
<!ATTLIST a
myattr CDATA #IMPLIED
>
See: 6.1. Defining additional attributes -
http://www.w3.org/TR/1999/xhtml-modularization-19990406/developing.html#s_dev_attrs
However i am not sure where to put that statement.
I have tried adding it like so:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<!ATTLIST a
myattr CDATA #IMPLIED
>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
...
</head>
<body>
...
</body>
But when I pick up the doc using DOM that extra DTD statement is ignored.
I have also tried:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
<!ATTLIST a
myattr CDATA #IMPLIED
>
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
...
</head>
<body>
...
</body>
But that really caused DOM to throw a wobbly.
So I'd appreciate it if someone could show me a sample xhtml document that has an additional attribute defined. (i.e minimal full doc that could validate)
As you might have guessed....xhtml is not my strong point.
Your second example is correct, apart from the missing </html> end-tag. With that added it parses OK for me. What exactly “throws a wobbly”?
The ATTLIST declaration must indeed go in the DTD, the internal subset of which is within square brackets inside the DOCTYPE declaration.
(What are you hoping to achieve with this? Browsers don't care, even if they are running in native application/xhtml+xml mode. In normal text/html tag soup mode the DTD internal subset will just confuse them.)

Resources