java - How to validate HTML using JTidy? -


I want to validate my html using JTD. I want true or false feedback if it is valid or not currently I am using this code.

  string html data = " gt;  gt; & lt; / head> gt; & lt; body & gt; & lt; div & gt; ; Hello Java & lt; / div & gt; & lt; / body & gt; & lt; / html & gt; "; Clear clean = new clean (); InputStream stream = new bytereinputstream (htmlData.getBytes ()); Lowly Pars (stream, system out);  

Is there any way or method through which I get a Boolean response whether my HTML is valid or not? According to the documentation, you can use the total error numbers for your final parse operation.

Then you can do something like this

  Private boolean is Valid (string HTML data) {Clear clean = new clean (); InputStream stream = new bytereinputstream (htmlData.getBytes ()); Lowly Pars (stream, system out); Return (TDGetter's Errors) == 0); }  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -