1

I validated my website using: https://validator.w3.org/#validate_by_upload and I got no errors. However, the website recently changed and now I get these 2 messages:

Info: The Content-Type was application/octet-stream. Using the XML parser (not resolving external entities). Fatal Error: Empty document, with no root element.

What do these messages mean? How do I correct the error?

The settings I used were: Encoding: utf-8 document type: HTML5

SIMPLE HTML:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>


<link href="css/omnicode.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js">
</script>
<![endif]-->

</head>

<body>
<div class="container">
  <header>
    <h1>Header</h1>
  </header>
  <hr>
  <p> TEXT </p>
  <hr>
  <footer>Footer</footer>
</div> 
</body>
</html>
6
  • Are you still getting errors after adding the closing div element? The HTML is reported as valid when I tested it with the closing </div> added. Commented Jul 29, 2015 at 20:59
  • When I click file upload: Encoding: utf-8 document type: HTML5. The code I pasted in my question: shows this: Info: The Content-Type was application/octet-stream. Using the XML parser (not resolving external entities). Fatal Error: Empty document, with no root element. I have a closing </div> in my code, so I do not understand why I need to add one. Commented Jul 29, 2015 at 22:17
  • If I copy/paste your code in to the checker it validates without error. There must be something about the file you are uploading. Are you using Windows/Mac/Linux/Other operating system to create the file, and in which application? Commented Jul 29, 2015 at 22:20
  • I've also tried saving your sample HTML (with the div fix) to a file and uploading it to the checker. It validated it as HTML and found no errors. Commented Jul 29, 2015 at 23:56
  • I copied and pasted my code in the checker: and I got this message: Info: The Content-Type was text/html. Using the HTML parser. Info: Using the schema for HTML with SVG 1.1, MathML 3.0, RDFa 1.1, and ITS 2.0 support. When you mentioned "with the div fix", are you referring to my closing </div> before </body>? Commented Jul 30, 2015 at 4:51

3 Answers 3

1

It could be because you have opening tags that are not closed. I put your code in to the checker and it complained about the body element being found before the div is closed:

<body>
  <div class="container">  <!-- no closing tag for this div -->
  <header>
    <h1>Header</h1>
  </header>
  <hr>
  <p> TEXT </p>
  <div>
  <hr>
  <footer>Footer</footer>
</div> 
</body>
Message filtering
Info: The Content-Type was text/html. Using the HTML parser.
Info: Using the schema for HTML with SVG 1.1, MathML 3.0, RDFa 1.1, and ITS 2.0 support.
Error: End tag for  body seen, but there were unclosed elements.
From line 27, column 1; to line 27, column 7
Error: Unclosed element div.
From line 17, column 1; to line 17, column 23

Fix that and rerun the tests.

Sign up to request clarification or add additional context in comments.

1 Comment

<hr> is self closing, in HTML5 it don't need <hr />, hence the <!DOCTYPE html>
1

This is an issue when using the old w3 validator and Safari as the uploading Browser; If you upload using Chrome it should work fine, or if you cut and paste it should work fine. Also, if you upload using Safari to the "new school" validator it will work as well.

http://html5.validator.nu/

Comments

0

It looks fine but some tags need to be closed like your hr's

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>


<link href="css/omnicode.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js">
</script>
<![endif]-->

</head>

<body>
<div class="container">
  <header>
    <h1>Header</h1>
  </header>
  <hr />
  <div>
  <p> TEXT </p>
  </div>
  <hr />
  <footer>Footer</footer>
</div> 
</body>
</html>

1 Comment

Since I am using HTML5, the hr tag does not need to be closed. I put <div class="container" without the closing tag, and I still get errors and one of them is that I need a closing > tag after <div class="container" >

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.