I am trying to validate a String
of HTML code. That is, when HTML code syntax is wrong I want to know, perhaps in the form of a return false
.
I am currently using JTidy but it doesn't tell me there was bad syntax it just corrects it. I don't need to correct it just say if the synthax is bad or good.
JTidy code:
String s = "<td>cookie<td>"; // bad syntax.
Tidy tidy = new Tidy();
InputStream stream = new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
tidy.parse(stream, System.out);
Any help is appriciated.