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...
invalid file:
<!doctype html> ... <div><a>Invalid Link position<a>...
valid file:
<!doctype html> ... <div><table><tr><td><a>Valid Link position<a>...