I want validate HTML code in Java.
Like this:
HTMLValidator.validateHTML("aaa<b>bbb<b>");
// Returns false, because tag <b> is not closed
What Java libraries exist to do this?
This validator checks the markup validity of Web documents in HTML, XHTML, SMIL, MathML, etc. If you wish to validate specific content such as RSS/Atom feeds or CSS stylesheets, MobileOK content, or to find broken links, there are other validators and tools available.
The W3C HTML validatorValidate by URI: Allows you to enter the address of a page already on the internet for validation. Validate by File Upload: Allows you to upload an HTML file for validation. Validate by Direct Input: Allows you to paste the contents of an HTML file into the window for validation.
You can try JTidy. JTidy is a Java port of HTML Tidy, a HTML syntax checker and pretty printer.
http://jtidy.sourceforge.net/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With