ladar
ladar

Reputation: 5876

How to validate html5 document against given structure?

I have html5 document and I want to check its structure against some my own definition (similiar to xml file and XML Schema). Is there a way to do that except of some ugly manual parsing? Since HTML5 is not XML-friendly (not all tags have to be closed etc.) , I can't use DTD/XML Schema (or RelaxNG which I don't know) to do that, right?

Are there any schema languages or maybe even validators (like Saxon engine...)? Javascript/jQuery implementation would be best.

Sample: - Rule: all must be inside or elements - not sure which "language" to use to describe it more formally...

Upvotes: 2

Views: 346

Answers (2)

Aravindan R
Aravindan R

Reputation: 3084

Take a look at this question,

Yet another question regarding the html5 dtd/schema

There is no schema for HTML5. A quick google search would bring up these validators,

  1. http://html5.validator.nu/
  2. http://validator.whatwg.org/

But these require your HTML5 document to be public.

Upvotes: 1

awiebe
awiebe

Reputation: 3836

Some web browsers will check your page for you, if you are concerned about compatability stick with XHTML until html 5 has been wisely accepted, or a strict doctype is available for it.

Upvotes: 0

Related Questions