Tidy tidy = new Tidy(); tidy.setXHTML(true); tidy.setXmlTags(false); tidy.setXmlOut(true); tidy.setTidyMark(false); tidy.setMakeClean(true); tidy.setUpperCaseTags(true); tidy.setWraplen(750); tidy.setShowWarnings(true); //tidy.setIndentContent(true); tidy.setIndentContent(false); tidy.setQuoteAmpersand(true); tidy.setQuiet(false); tidy.setQuoteNbsp(true); tidy.setRawOut(false); tidy.setWord2000(true); tidy.setCharEncoding(Configuration.UTF8); //jai Changes done as per the html online thing tidy.setDropEmptyParas(true); //jai ..> StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); // tidy.setErrout(pw); InputStream in = new ByteArrayInputStream(userHTML.getBytes(Constants.OUTPUT_CONTENT_ENCODING)); ByteArrayOutputStream out = new ByteArrayOutputStream(); tidy.parse(in, out); byte[] bOut = out.toByteArray(); try { pw.flush(); pw.close(); } catch (Throwable _tw) { } String xHtmlBody = new String(bOut, Constants.OPERATIONAL_CONTENT_ENCODING); // remove xHtmlBody = xHtmlBody.substring(xHtmlBody.indexOf(">") + 1); xHtmlBody = xHtmlBody.trim(); return xHtmlBody;