Possible Duplicate:
Recommend a HTML Validator in java
How to validate HTML from Java?
How would I be able to check if some string represented valid HTML code? (With being able to have whitespace before and after the HTML code)
For example, the string <html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>
would return true since it is valid HTML.
But, the following string <html><body><h1>p>My first paragraph.</p></body></html>
would return false since it is not valid HTML.