How can I get the error/warning messages out of the parsed HTML using JTidy?
- by chetu
I am able to parse the HTML but I want to extract the warning messages from the parsed HTML and show them to the user.
Here is my code:
Tidy tidy = new Tidy();
StringBuffer StringBuffer1 = new StringBuffer("<b>Hello<u><b>I am tsting another one.....<i>another.....");
InputStream in = new ByteArrayInputStream(StringBuffer1.toString().getBytes("UTF-8"));
Writer stringWriter = new StringWriter();
tidy.setPrintBodyOnly(true);
tidy.setQuiet(true);
tidy.setShowWarnings(true);
tidy.setTidyMark(false);
tidy.setXHTML(true);
tidy.setXmlTags(false);
Node parsedNode = tidy.parse(in, stringWriter);
System.out.print(stringWriter.toString());