Valid html 5 sample - html

I'm looking for an html 5 document in xml format that is considered valid by these tools:
eclipse juno html validator
w3c validator http://validator.w3.org
http://html5.validator.nu/
firefox html validator https://addons.mozilla.org/fr/firefox/addon/html-validator/
Can anyone provide me such a document if it exists or explain me which validator aren't conform to the standard. The best I've found is the following document:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
dir="ltr">
<head>
<meta name="description"
content="application/xhtml+xml; charset=UTF-8" />
<title>Get an object</title>
</head>
<body>
<section>This is a section</section>
</body>
Note that document contains a section element which is only valid in html 5. This document isn't valid for eclipse and firefox.
Regards,
Mickaël
Answer:
Thanks for your useful link igo: http://docs.webplatform.org/wiki/html/tutorials
I learnt that even if using xhtml syntax is highly recommended, including the xml header line may cause problems to some browsers. So I removed it and the following code is validated by all validators above, eclipse validates it as html5 using xml constraints.
<!DOCTYPE html>
<html lang="en"
dir="ltr">
<head>
<meta name="description"
content="application/xhtml+xml"/>
<meta charset="UTF-8"/>
<title>Get an object</title>
</head>
<body>
<section>This is a section</section>
</body>
</html>

check the documentation on new launched web from W3C at https://www.w3.org/QA/2002/04/valid-dtd-list.html

Related

I cannot validate this blank HTML page to XHTML 5.1

I cannot validate this blank page to XHTML 5.1.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>XHTML 5.1 blank page</title>
</head>
<body>
<h1>Blank page</h1>
<p>Text here.</p>
</body>
</html>
All tags are well-closed and I specific the DOCTYPE, what I'm wrong?
You need requires that the attribute indicated should be used. xmlns
And you should look this if you sse the 'lang' or 'xml:lang' attribute to denote the language of the document.

how can i give a multilingual support to HTML page?

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="ar">
<body>
<p>بيـــان أعـــرف عميــــــلك</p>
</body>
</html>
I am getting this as my result : بيـــان أعـــر٠عميــــــلك
Can anyone help me?
Strangely, I can't repeat your results in my browser. Where do you get your results?
However, I think what Xufox suggests is a good practice, to set charset as utf-8 in you meta tag in header.
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="ar">
<head>
<meta charset="utf-8"/>
</head>
<body>
<p>بيـــان أعـــرف عميــــــلك</p>
</body>
</html>

Valid XHTML: "itemscope" is not a member of a group specified for any attribute

I am trying to validate my document as XHTML 1.0 Transitional (W3C). I have the following error:
"itemscope" is not a member of a group specified for any attribute
Which corresponds to this code:
<body class="innerpage" itemscope itemtype="http://schema.org/Physician">
<body class="innerpage" itemscope itemtype="http://schema.org/Physician">
<!-- Facebook Conversion Code for Leads -->
<script type="text/javascript" src="js/face.js"></script>
</body>
</html>
How can this be solved?
Thanks!
Unfortunately, it is not possible, because http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd knows nothing about those attributes (itemscope, itemtype). You can convince yourself by downloading that file to your computer and trying to find (Ctrl+F) the words itemscope or itemtype within that document. You will get 0 results.
So basically, You’ve got 2 choices starting from here:
If You want to continue using itemscope and itemtype attributes You
have to switch to HTML5 doctype, then your document would look like
as follows:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body class="innerpage" itemscope itemtype="http://schema.org/Physician">
<p>Content</p>
</body>
</html>
This will result in:
This document was successfully checked as HTML5!
If You need to preserve XHTML Document Type Definition, then You have to switch from microdata to RDF and Your document will look the following:
<!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">
<head>
<title>Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body class="innerpage" vocab="http://schema.org/" typeof="Physician">
<p>Content</p>
</body>
</html>
This will result in:
This document was successfully checked as -//W3C//DTD XHTML+RDFa 1.1//EN!

HTML5 (XHTML style strict format of coding)

Like the title says, what exactly does that mean? Ive tried googling for answers but I still dont understand? so the entire document has to be in a HTML5 format right? and the syntax has to be in strict XHTML?
so is this the correct header to use in this situation? Thank you so much :)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Page Title</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8"/>
</head>
<body>
</body>
</html>
I think you are looking for polyglot HTML5. It's still HTML, but "could be served" as XML.
This is how the base structure looks like:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>title</title>
</head>
<body>
</body>
</html>
Here is another article: http://www.xmlplease.com/xhtml/xhtml5polyglot/
The normal doctype (see HTML syntax - doctype) for HTML5 is:
<!DOCTYPE html>
You can also use deprecated doctypes, but the term says pretty much everything about them.
And, no, HTML5 markup does not need to be valid XHTML, in the empirical sense that HTML5 markup might be both valid HTML and non-valid XHTML/XML.
Three meaningful considerations are:
in HTML5 <br> is allowed and <br/> is too.
a closing /> on non-void elements does not behave like it does in XML: it's ignored, you cannot have auto-closing entities.
HTML5 introduces a set of so-called semantic tags (nav, footer, article...), that are not specified in XHTML.
Regarding point 2, this is not valid:
<!DOCTYPE html>
<html>
<head><title>Dummy</title></head>
<body>
<div/>
</body>
</html>
you have to write:
<!DOCTYPE html>
<html>
<head><title>Dummy</title></head>
<body>
<div></div>
</body>
</html>
See HTML syntax - elements for more information.
check the required syntax of each element in HTML5 according to web specs
http://w3-video.com/Web_Technologies/HTML5/index.php
provides a syntax section for each element:
e.g.
http://w3-video.com/Web_Technologies/HTML5/doctype/html5_doctype_syntax.php

What HTML version is this html

What html version is code snippet below?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="Generator" content="some info here ..." />
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
Lets go line by line
<!DOCTYPE html> - HTML5 Doctype
<html xmlns="http://www.w3.org/1999/xhtml"> - Refer here
<head> - Document head element
<meta name="Generator" content="some info here ..." /> Description of the program you used to create the HTML document
<meta charset="utf-8" /> - Document Character Encoding, Good read
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> Read Here And Here
I would've certainly wrote a big fat description for each but realized that these were already asked in different questions, so thought to link them instead of repeating the same thing here again.
The code snippet is mostly the start of an HTML5 document in XHTML (XML) serialization, sometimes confusingly called XHTML5.
It is not a conforming document, however; the current HTML5 CR does not allow the attribute http-equiv="X-UA-Compatible" (on rather formal grounds, but still).
The doctype belongs to HTML5 Doctype definition.
So the rest of the document should be bases on HTML5